I have a 2x2 design research and I have over 150 participants. So I have 4 different conditions and I named them as 11
, 12
, 21
, 22
.
I need to transform all my cell values to matrices with cell2mat
and need to do that for each participant. I am trying to write a for
loop to have different values for each participant, but I could not figure out how to do it.
%% each participant records
%conditions are = 11 , 12 , 21, 22
%participants 1:101 (p1,p2,p3.....p150)
for i = 1:150
%personal control (pc)
p_pc11= cell2mat(A.pc11(i,:));
p_pc12= cell2mat(A.pc12(i,:));
p_pc21= cell2mat(A.pc21(i,:));
p_pc22= cell2mat(A.pc22(i,:));
save('p?_pc11' , p1_pc11)
end
It should be something like this but I do not know how to save each variable differently. I tried p(i)_pc11 , p'i'_pc11
, but it gave errors. I need to have a unique variable for each participant. I am keeping them in structs but it is not good for running anova or manova.
So my question is, how can I save each participants value with different names?