How to get the array elements indexes

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

>> 1:4
ans =
1 2 3 4
the cyclist
the cyclist 2015년 7월 29일
You might want to check out some of the free, online resources available for learning MATLAB. Here is one place to get started.

댓글을 달려면 로그인하십시오.

답변 (1개)

the cyclist
the cyclist 2015년 7월 29일
편집: the cyclist 2015년 7월 29일

0 개 추천

Index_A = 1:numel(A)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2015년 7월 29일

댓글:

2015년 7월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by