Hi everyone, New to matlab here and I can't seem to find a previous answer to this question.
I'm trying to populate a matrix element by element using a for loop, but I'm running into a problem. Because of the way I need it to load in the data, I have the subject numbers listed in a valArray for the for loop. This works fine for loading, but when I try to index the matrix, it puts it the value in the element of the actual VALUE of the number, whereas I want it to be in the element of the iteration number it represents. Here's what I have:
for s = [1297 1304]
for b = 1:2
LE_allsubs_avg(s) = mean(LE_byblock);
LE_allsubs_std(s) = std(LE_byblock);
GE_pos_allsubs_avg(s) = mean(GE_byblock);
GE_pos_allsubs_std(s) = std(GE_byblock);
So what I want is for the value I have produced for subject 1297 to go in element ONE of the LE_allsubs_avg matrix and the value for subject 1304 to go in element TWO of the allsubs matrix, etc. But what I get is the value for subject 1297 going into element 1297 of the allsubs matrix. Any way I can remedy this, or do I have to make a new loop somehow with i=1:number of subjects?
Additionally, I have previously in the code initialized all the matrices to their correct sizes.
Thanks so much- any help is greatly appreciated!!!