how to find index of the double

133 ビュー (過去 30 日間)
Muhammad
Muhammad 2021 年 5 月 29 日
編集済み: Image Analyst 2021 年 11 月 11 日
i want to find the indese of the following data
what should be the code for this
  1 件のコメント
Jan
Jan 2021 年 5 月 29 日
The question is not clear. What are "the following data"? Do you want to sort the vector?

サインインしてコメントする。

採用された回答

Image Analyst
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);

その他の回答 (1 件)

Asmit Singh
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
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
Jan 2021 年 11 月 11 日
編集済み: Image Analyst 2021 年 11 月 11 日
Use the code show in this answer already:
index = find(covid == 1122)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by