フィルターのクリア

how to select certain elements from a matrix?

2 ビュー (過去 30 日間)
Uet
Uet 2014 年 6 月 11 日
コメント済み: Uet 2014 年 6 月 11 日
A=[1,2,3,4], B=[90,0,40,0;0,0,10,60;55,15,0,10;0,15,5,0]
Hi everyone.. I want to select indexes of only one zero from each row and respective column. please help me in writing matlab code for this problem. Thanks in Advance

採用された回答

David Sanchez
David Sanchez 2014 年 6 月 11 日
B=[90,0,40,0;
0,0,10,60;
55,15,0,10;
0,15,5,0];
[col row]=find(B==0);
A= [row col] % coordinates of your zero-elements
A =
1 2
1 4
2 1
2 2
3 3
4 1
4 4
  3 件のコメント
Uet
Uet 2014 年 6 月 11 日
Thank you very much sir, is there any way so that i can delete repeated rows as you mentioned in A? as you can see there are double entries from 1st, 2nd and 4th rows. I want to select one from each
Uet
Uet 2014 年 6 月 11 日
Thanks alot Sir.. Much obliged

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by