for loop help with loop range

1 回表示 (過去 30 日間)
Nina Perf
Nina Perf 2021 年 8 月 2 日
編集済み: Nina Perf 2021 年 8 月 3 日
I nedd help with the following:
Thank you!
  1 件のコメント
dpb
dpb 2021 年 8 月 2 日
How do you intend to hold the disparate output size of either three (3) or two (2) return values?
This seems exceedingly awkward construct; I'd suggest instead an array of Nx3 with a missing value for those without a z coordinate.
Otherwise, how are these to be used later on -- should they not be the same variable because they are three disparate quantities, not one (or maybe there are two)?

サインインしてコメントする。

回答 (1 件)

dpb
dpb 2021 年 8 月 2 日
" extract data of the first 3 columns (x,y,z) for sensorIdx 1,2,5,6,7. For sensorIdx 3 and 4 I want to extract columns 5,6 (x,y) and 7,8 (x,y) respectively."
ch_xyz=1:3;
id_xyz=[1 2 5:7];
xyz=data(id_xzy,ch_xyz);
ch_xy=[5 6;7 9];
id_xy=[3; 4];
xy=cell2mat(@(i) data(id_xz(i),ch_xy(i,:),1:numel(id_xy),'uni',0).');

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by