How to get the column number that have ones in a row?

1 回表示 (過去 30 日間)
fyza affandi
fyza affandi 2018 年 11 月 26 日
回答済み: madhan ravi 2018 年 11 月 26 日
t(:,:,1) =
1 10 19 28 37 46 55 64 73 82
2 11 20 29 38 47 56 65 74 83
3 12 21 30 39 48 57 66 75 84
4 13 22 31 40 49 58 67 76 85
5 14 23 32 41 50 59 68 77 86
6 15 24 33 42 51 60 69 78 87
7 16 25 34 43 1 61 70 79 88
8 17 26 35 44 53 1 1 80 89
9 18 27 36 45 54 63 72 1 1
How to get the number of column for row 8 (only with 1) ?
The result will be column 7 & 8

採用された回答

madhan ravi
madhan ravi 2018 年 11 月 26 日
same like your previous question use:
idx=find(t(8,:,1)==1)
ind2sub(size(t),idx)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeElementary Math についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by