Hello π I currently need to run a loop with the output of "find(collated(1,:) ==0 )". Currently, the output is [2 ; 4 ; 5 ; 6 ; 8], and I need to run the loop with these indexes. I couldn't use a for loop as the number are not increasing by 1. Is there a way I could manage the loop so that the output does not have to run in an +1 order? I read that a while loop may be useful, but am still new to the while loop.
PS
the matrix 'collated' is a 35 x 9 logical, so the idea that I want the code to work is that with each row of collated, I find the 0s i.e in row 1, it will be [2 ; 4 ; 5 ; 6 ; 8], row 2 [2 ;3], row 3 [4; 7; 8; 9] etc…
Appreciate any sort of help! π
for k = 1:35 while A == find(collated(k,:) ==0) selectedlocal = find(sesslocal == A); pfc = dataset_p(1,:); fef = dataset_f(1,:); zpfc = zscore(pfc); zfef = zscore(fef); zzpfc = zpfc(selectedlocal); zzfef = zfef(selectedlocal); [R,P] = corrcoef(zzpfc,zzfef) end end
Best Answer