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!

채택된 답변

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 CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by