MATLAB: Creating a logical array within a loop

array

I am trying to create a logical array in a loop, wherein each iteration of the loop should create a new column in my array:
for i= 1:size(Behaviours) %Behaviours is a 27x1 cell array containing strings
temp = strcmp(Shank2_KOs(k).BehaviourType, Behaviours(i)); %creates the logical vectors
temp_array = temp(:,i);
end

Best Answer

In a loop the indexing works just as normal. I also made some other changes to your code.
temp_array=zeros(____,numel(Behaviours));
for n= 1:numel(Behaviours) %Behaviours is a 27x1 cell array containing strings
temp = strcmp(Shank2_KOs(k).BehaviourType, Behaviours(n)); %creates the logical vectors
temp_array(:,n) = temp;
end