extracting the second column of all cells of a struct

6 ビュー (過去 30 日間)
Sahar khalili
Sahar khalili 2022 年 10 月 11 日
コメント済み: Sahar khalili 2022 年 10 月 12 日
I have a struct, x1_surf, that contains 1070 cells, each cell has 4 cells, now I want to extract the second column of the inner cells with the order.
This is x1_surf
This is the x1_surf{1,1}
now, I want to extract the second column of all inccer cells with the correct order, I mean x1_surf{1,:}{1,2}
I write a script like that:
It works correcly for some files, however for some other files, the order of the date is mixed up and they are not in the right order. Could anyone help me how I can rewise it?
  1 件のコメント
Stephen23
Stephen23 2022 年 10 月 11 日
You should replace all of the nested 1x4 cell arrays with TIMETABLEs or TABLEs.

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

採用された回答

David Hill
David Hill 2022 年 10 月 11 日
for k=1:length(x1_surf)
x2_surf{k}=x1_surf{k}{2};
end
  5 件のコメント
Sahar khalili
Sahar khalili 2022 年 10 月 12 日
Thank you so much, it worked.

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

その他の回答 (0 件)

カテゴリ

Find more on Structures 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!

Translated by