How to update multi-level cell array in a Parfor loop
2 views (last 30 days)
Show older comments
A=cell(length(10),length(1920));
parfor i=1:length(10)
temp=cell(1,length(1920));
for j=1:length(1920)
temp{j}=data{i}(data{i}(:,1)==dateIndex(j),2);
end
A{i,:}=temp;
end
I have this code in my program. I have A which is a 10 by 1920 cell array. and the loop inside will generate a variable 'temp' which will be 1 by 1920 multi-level cell array. looks like this

I want use make the A to be a 10 by 1920 first, and then aggregate all values (keep all values) in those 10 rows into one row, to be a 1by1920 cell array.
but i only managed to do A as follow:

Is there any suggestions and How can i aggregate 10 row multi-level cell into one row.
1 Comment
Walter Roberson
on 12 Aug 2015
Did you create your own variable or function named length? Because length(scalar) is 1 for all constants. length(1920) is 1
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!