有一个结构体如图,我想引用Q这一列,应该怎么办呢?
试了两个命令,都不行。
Q = Segment{:,1,:};
Q = Segment(1:5).Q;
Q = Segment(:).Q;
Q = Segment{:}.Q;
Q = Segment.Q;

 채택된 답변

0 개 추천

适用于1维2维
高维下要么老老实实用循环
Q = cell(5,1);
for i = 1:5
    Q{i,1} = Segment(i,1).Q;
end
要么左边用方括号
Q = cell(5,1);
[ Q{:,1} ] = Segment.Q;

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!