Accessing and using struct array using vectorization

1 回表示 (過去 30 日間)
Askic V
Askic V 2022 年 8 月 25 日
コメント済み: Voss 2022 年 8 月 26 日
Hello,
I have a cell array structured like this:
list_el =
36×3 cell array
{[ 1 3]} {0×0 double} {0×0 double}
{[ 1 5]} {0×0 double} {0×0 double}
{[ 1 7]} {0×0 double} {[ 3 5]}
...
And I use this loop to extract data to another matrix. I wonder if there is a way using vectorization to do this?
aa = zeros(size(list_el,1),2);
for i = 1: size(list_el,1)
aa(i,:) = list_el{i,1};
end
Thank you!
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 8 月 25 日
common would be to use cell2mat(list_el(:, 1)) and assume that function is coded well.

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

採用された回答

Voss
Voss 2022 年 8 月 25 日
aa = vertcat(list_el{:,1});
  3 件のコメント
Askic V
Askic V 2022 年 8 月 26 日
移動済み: Voss 2022 年 8 月 26 日
Walter and Voss, thank you very much for your answer. They are exactly what I was looking for. Cheers!
Voss
Voss 2022 年 8 月 26 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by