How can I concatenate the last matrices of a multiple-dimensional cell array iteratively?
Show older comments
In particular I want to add a new matrix (?x24) to an existing matrix (?x24) in every loop step, so that in the end there is one big matrix for each condition (1,2,3), which consists of all matrices of condition 4, i.e. X{1,2,3} = [M1{1,2,3,1}(:,1:24);M1{1,2,3,2}(:,1:24);M1{1,2,3,3}(:,1:24);....;M1{1,2,3,n}(:,1:24)] But how can be done this iteratively? This is what I have done already:
for Ind1 = 1:length(probanden)
for Ind2 = 1:length(ss)
for Ind3 = 1:length(bin)
for Ind4 = 1:length(reg)
allData{ind1,ind2,ind3} = [X{Ind1,Ind2,Ind3,Ind4}(:,1:24) Ind4]
end
end
end
end
Many thanks in advance! Lena
1 Comment
I've edited the question to format the code. Please use the "{} Code" button to improve the readability. Thanks.
It is not clear, if the shown code solves your needs already. If not, what is missing? In the description you use "X" and "M1", but in the code we see "allData" and "X". This is confusing.
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!