select a row from a matrix

1 回表示 (過去 30 日間)
Johannes Deelstra
Johannes Deelstra 2016 年 10 月 11 日
コメント済み: Johannes Deelstra 2016 年 10 月 12 日
Hei, How do I do the following task. I have a 90 x 12 matrix. From each three rows (1:3;4:6;7:9 etc.) I have to select one row. The condition is as follows.
If cell (2,12) < (1,12) and (2,9)>0 row 2 is selected.
But if then again cell (3,12) < 2,12) and (3,11) >0 row 3 is to be selected.
If however to start with (2,12) > (1,12) the first row is selected, and no comparison between (3,12) and (2,12) is to be considered.
Thanks in advance. Johannes
  1 件のコメント
Johannes Deelstra
Johannes Deelstra 2016 年 10 月 12 日
hei solved the problem no need for further attention Johannes

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

採用された回答

Pritesh Shah
Pritesh Shah 2016 年 10 月 12 日
a=ones(90,12);
j=1;
for i=1:3:87
if a(i+1,12)<a(i,12) & a(i+1,9)>0
b(j,:)=a(i+1,:);
elseif cond
b(j,:)=a(i+2,:);
else
b(j,:)=a(i,:);
end j=j+1;
end
  1 件のコメント
Johannes Deelstra
Johannes Deelstra 2016 年 10 月 12 日
thanks for the advice

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResampling Techniques についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by