figureの座標データ取得について
12 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Naoya
2022-3-14
あくまでも一例となると思いますが、以下のように 構造体配列の各要素に特定の処理を適用することができる arrayfun関数を使うと比較的スマートに処理することができると思われます。
% DataIndex に対して昇順にソートする (ここでは配列要素順を取得)
[~,idx] = sort( arrayfun(@(x) x.DataIndex,cursor_info) );
% DataIndex と Position の 2要素目を取得
celldata = arrayfun(@(x) [x.DataIndex, x.Position(2)], cursor_info(idx)', 'UniformOutput', false);
% セル配列から通常の行列に変換
matdata = cell2mat(celldata);
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!