overwrite cell array in a loop
古いコメントを表示
the code is given below; parts(day) are calculated using some data which is let say comes out as 3 4 2 for day 1 2 3. complete code is attached in file.. when the value of parts(day) decreses from previous loop, the cell cannot reassign the new value but overwrite on previous and causes extra cell which creates error in reshaping.
for day=1:3
n = 2;
Psub{parts(day}=[];
for ii=1:(parts(day)*2)/n
Psub{ii}=process_plan((ii-1)*n+1:ii*n,:);
end
P=reshape((cell2mat(Psub)),parts(day)*2,machines);
2 件のコメント
Bob Thompson
2018 年 7 月 31 日
編集済み: Bob Thompson
2018 年 7 月 31 日
I'm a little confused by what you're problem is and would like some more context. Would you mind including more of your code (the whole loop if possible)?
summyia qamar
2018 年 7 月 31 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および 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!