필터 지우기
필터 지우기

how to read data in 1*3 struct for one filed directly?

조회 수: 1 (최근 30일)
Xiaodi
Xiaodi 2017년 9월 8일
댓글: Stephen23 2017년 9월 8일
Hi, I have a struct and the data,
mystruct = struct([]);
mystruct(1).a = 1;
mystruct(2).a = 2;
mystruct(3).a = 3;
how can I read the data of a directly without using a loop, with a loop man can du it like
for i = 1:length(mystruct)
value_a(i) = mysruct(i).a;
end
than I get
value_a = [1 2 3];
maybe man can read it directly with a special syntax.
Thanks forward!!

채택된 답변

KSSV
KSSV 2017년 9월 8일
iwant = [mystruct.a]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by