Are we not allowed to use max function in a for loop? I have a 25×50 cell array A, and each element of A is a vector of various lengths.
for j=1:25 temp=cell2mat(A{j,20}); [max,ind]=max(temp); m(j)=max;end
the length of the vector "temp" is different at each loop. at the second loop I get this error even though I can see a value in the Max column of workspace for temp.:
Subscript indices must either be real positive integers or logicals.
and it messes up the whole software because then I try:
>> xx=1:10;>> max(xx)Index exceeds matrix dimensions.
Does anyone know what is wrong? Thanks
Best Answer