有一个结构体如图,我想引用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!