How to get the array elements indexes

10 Ansichten (letzte 30 Tage)
Mekala balaji
Mekala balaji am 29 Jul. 2015
Kommentiert: the cyclist am 29 Jul. 2015
Hello Sir/Mada, I have matrix:
A=[2 9 0 3]
and I want to get Index_A=[1 2 3 4]
I used "find"
I got the answer (which is not I required),here it didn't considered "Zero" It is only considering non zero elements. Kinldy help How to I get the indexes including zero elemets.
I used this code:
>> A=[2 9 0 3]
A =
2 9 0 3
>> Index_A=find(A)
Index_A =
1 2 4
Many many thanks in advance.
  2 Kommentare
Stephen23
Stephen23 am 29 Jul. 2015
>> 1:4
ans =
1 2 3 4
the cyclist
the cyclist am 29 Jul. 2015
You might want to check out some of the free, online resources available for learning MATLAB. Here is one place to get started.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

the cyclist
the cyclist am 29 Jul. 2015
Bearbeitet: the cyclist am 29 Jul. 2015
Index_A = 1:numel(A)

Kategorien

Mehr zu Matrix Indexing 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