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

1 次查看(过去 30 天)
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.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by