フィルターのクリア

Flip size of cells inside cell aray

1 回表示 (過去 30 日間)
Jung BC
Jung BC 2016 年 12 月 15 日
編集済み: Jung BC 2016 年 12 月 15 日
Hello everyone,
It may be silly to ask but i am new to cell-arrays calculations. I have a cell array of size 1x316 which contains more cells of different sizes and they are all double numeric values such as:
main cell-array: duration(1x316),
And further,
duration(1x316)-> {1x8115},{1x4790}, {1x6675},{1x4981}.... etc.
Now, i want to flip the size of each cells inside duration cell-array as:
duration(1x316)-> {8115x1},{4790,1},{6675x1},{4981x1}....etc.
Any ideas? Any help? Will appreciate it!
Thanks,

採用された回答

Stephen23
Stephen23 2016 年 12 月 15 日
for k = 1:numel(duration)
duration{k} = duration{k}.';
end
  3 件のコメント
Stephen23
Stephen23 2016 年 12 月 15 日
編集済み: Stephen23 2016 年 12 月 15 日
@Jung BC: use cell2mat to convert from a cell array to a numeric matrix. Note that the cell array elements will need to be of suitable sizes. I do not have your data, but this might work for you:
for k = 1:numel(duration)
duration{k} = cell2mat(duration{k}.');
end
If this does not work then please make a new comment and upload your data by clicking on the paperclip button.
Jung BC
Jung BC 2016 年 12 月 15 日
編集済み: Jung BC 2016 年 12 月 15 日
Thanks a lot Stephen. It worked well !!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by