Data is all spaced out, I want it to fill from first row in matrix
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have this code:
%% Combine the data %combined = [6050,54]% define size of combined
SWOA = zeros(100,5); CWOA = zeros(100,5); SWA = zeros(100,5); CWA = zeros(100,5);
for i = 8:length(mydata)%loop to group data together into jump types
if grouped(i,4) == 1
SWOA(i,1) = grouped(i,1);
else if grouped(i,4) == 2
CWOA(i,1) = grouped(i,1);
else if grouped(i,4) == 3
SWA(i,1) = grouped(i,1);
else if grouped(i,4) == 4
CWA(i,1) = grouped(i,1);
else if grouped(i,4)== 0
continue
end
end
end
end
end
end
I have wrote the code so that if fills the row with the corresponding trial number however this is the result:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162682/image.png)
Instead of writing them to the corresponding row number I want it to fill the variable from row 1 cell 1 but in the loop I know I have writen for example SWOA(i,1) which I don't know how to change as it is in a loop and I need all the values, I don't want it to overwrite everytime.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!