how to find index of the double
조회 수: 69 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634800/image.png)
i want to find the indese of the following data
what should be the code for this
댓글 수: 1
Jan
2021년 5월 29일
The question is not clear. What are "the following data"? Do you want to sort the vector?
채택된 답변
Image Analyst
2021년 5월 29일
편집: Image Analyst
2021년 11월 11일
@Muhammad SULAMAN, you ask "i am tring to find the index of all the data written in double data", so here is a list of all the indexes of all the data in your vector:
allIndexes = 1 : length(covid);
To find the index of a certain, specific value in covid, use find():
index = find(covid == 1122);
댓글 수: 0
추가 답변 (1개)
Asmit Singh
2021년 5월 29일
편집: Image Analyst
2021년 11월 11일
In my understanding you are trying to find an index of a particular value in double. You can use the find function. You can know more using the documentation here. Here is code for a simple example.
% Load your covid double data into "a".
a
% Search for the value 1000
index = find(a == 1000);
댓글 수: 4
ganesh gng
2021년 11월 11일
In the following example if I want to find data 1122, output should be its index which is 6,
Is there any way to do this?
Jan
2021년 11월 11일
편집: Image Analyst
2021년 11월 11일
Use the code show in this answer already:
index = find(covid == 1122)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!