Data is all spaced out, I want it to fill from first row in matrix

1 view (last 30 days)
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:
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.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!