array in array struct

조회 수: 2 (최근 30일)
piero
piero 2023년 6월 5일
편집: Stephen23 2023년 6월 5일
i want element (1:10) of each fields..
f(1:end).F(1:10)
Intermediate dot '.' indexing produced a comma-separated list with 73 values, but it must produce a single value when followed by
subsequent indexing operations.

답변 (1개)

Stephen23
Stephen23 2023년 6월 5일
편집: Stephen23 2023년 6월 5일
"i want element (1:10) of each fields.."
Your structure only has one field, named "F".
You can iterate over the 73 elements of that structure using a loop or ARRAYFUN:
C = arrayfun(@(s)s.F(1:0),f,'uni',0)
  댓글 수: 3
piero
piero 2023년 6월 5일
편집: piero 2023년 6월 5일
if i write :
gg=[f.FF]
it's similar? the result is the same (i'll use gg)
Stephen23
Stephen23 2023년 6월 5일
편집: Stephen23 2023년 6월 5일
"With many fields what would it look like?"
Exactly the same, if you only want the values from one of those fields.
"if i write gg=[f.FF] it's similar?"
That creates a comma-separated list as inputs to the concatenation operator, so you end up with all content of the FF field horizontally concatenated. Perhaps you could use this, but it does not match the description in your question.

댓글을 달려면 로그인하십시오.

카테고리

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