Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
fyza affandi
fyza affandi am 26 Nov. 2018
Beantwortet: madhan ravi am 26 Nov. 2018
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

Akzeptierte Antwort

madhan ravi
madhan ravi am 26 Nov. 2018
same like your previous question use:
idx=find(t(8,:,1)==1)
ind2sub(size(t),idx)

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by