필터 지우기
필터 지우기

how to loop over the structure fields and get the type of data ?!

조회 수: 733 (최근 30일)
Ano
Ano 2017년 5월 22일
답변: James Tursa 2017년 5월 23일
hello! I would like to loop over the fields of a structure and get the type of data for each field, so I can do further manipulation if a field is a matrix , how can I implement this into matlab ?? thank you very much !

채택된 답변

James Tursa
James Tursa 2017년 5월 23일
You could loop over the fieldnames, e.g.
fn = fieldnames(mystruct);
for k=1:numel(fn)
if( isnumeric(mystruct.(fn{k})) )
% do stuff
end
end

추가 답변 (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