Converting logical to cell array
Show older comments
My code works with data extracted by a different code. Here it is:
for i=1:length(TrialTimestamps) %loop through trials
start1=TrialTimestamps(i);finish1=LightOnTimestamps(i); %trial onset to light on
temp1=(start1<=PokeTimestamps)&(PokeTimestamps<=finish1);% counts the nose pokes in this epoch
if temp1 == 0
temp1(i) = 0;
end
numpokes1(1,i)=temp1;
end
This is the error I receive: Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 61-by-1.
If I don't have numpokes, then temp1 only has logical, which cannot be used by the rest of the code. I need it to be in cell. I don't know how to turn it into a cell, but also preserve the entirety of the data.
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!