How to update multi-level cell array in a Parfor loop
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2015-8-12
Did you create your own variable or function named length? Because length(scalar) is 1 for all constants. length(1920) is 1
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!