Reshaping cells: transform a 1xj cell with i observations on into a 1xi cell with j observations
1 回表示 (過去 30 日間)
古いコメントを表示
Laura de Andrade Karpuska Santos
2018 年 9 月 9 日
再開済み: Walter Roberson
2018 年 12 月 22 日
I want to know the best practice to reshape cells.
Let's say I have a 1x5 cell that has 2 observations in each cell:
cbar=linspace(0,1,2);
for i=1:5
for j=1:2
VAR{i}(j)=i+cbar(j);
end
end
Let's say I want to create another cell that will be 1x2 and will have 5 observation in each cell (so I am reshaping the VAR cell above). The way I am approaching this, which is not working, is the following
for i=1:2
for j=1:5
VAR_new{j}(i)=VAR{i}(j);
end
end
It happens that for some reason the VAR_new is empty.
How can I do this properly? Thank you!
0 件のコメント
採用された回答
Vishal Bhutani
2018 年 9 月 12 日
Hi, the .mat file you have provided is having VAR variable of type cell with size 1x5. And each cell is having 10 observations, and VAR_new you are creating using your code is of size 1x5. Can you provide more details on that?
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!