MATLAB: MATLAB ‘isbetween’ function erases itself in for loop

isbetweenMATLAB

I am trying to create a logical array of when dates fall in between two Fridays. The loop below works on the first pass, but then when i=2, the previous logical 1s are erased (i.e. turn to 0). The second set of logical 1s then come up, but I need all of them, not just one iteration. I'd be grateful for any suggestions. Thanks.
for i = 1:length(secondFriday)
between=isbetween(vifDate,secondFriday(i)+1,thirdFriday(i));
end

Best Answer

The only possibility that comes to mind is to subscript ‘between’, specifically:
between{i} = ...;
That will save them in a cell array.