Skip to content

The reward delivery location

Johannes Niediek edited this page Dec 20, 2022 · 4 revisions

The food/water rewards in the RIFF are processed in the function behavOUT. This function uses named ports, and the Matlab function outputSingleScan (from the Data Acquisition Toolbox). Each call to this function causes a single reward release at the selected port.

function bline = behavOUT(app, behavDIO, lines)
if behavDIO.action == 0
    if app.MDPState.behavior == 'no'
        bline = lines;
    end
    return;
end

if app.MDPState.behavior == 'reward'
    for ii = 1:behavDIO.action
        switch behavDIO.port
            case 1 %infood1
                chanid = 'Port1/Line0:0';
            case 2 %inwater1
                chanid = 'Port1/Line2:2';
(...)
         end
         s = daq.createSession('ni');
         addDigitalChannel(s, 'Dev1', chanid, 'OutputOnly');
         outputSingleScan(s,0)
         outputSingleScan(s,1)
         release(s);   
    end

elseif app.MDPState.behavior == 'punish'
(...)
end
bline = lines;
end

In the current code, a reward is always delivered at the location where the correct nose-poke happened. behavDIO.port 1 refers to food at IA1, behavDIO.port 2 refers to water at IA1, and so on. But in order to study biases, we would like to deliver a food reward always from the same location, let's say at IA5. This is behavDIO.port 9.

So instead of the switch behavDIO.port ... case statements, we simply set a fixed

chanid = 'Port5/Line0:0';

That's it! from now on, all rewards will be food at IA5. Have you become curious how the rat is going to behave in this situation?


Other code modifications