Find index of specific rows of a table with value greater than a threshold

26 ビュー (過去 30 日間)
Apurva Godbole
Apurva Godbole 2020 年 5 月 27 日
回答済み: Chaitanya Mallela 2020 年 8 月 18 日
Hey, I have a data table (143 x 8). From this table, for column 8, I want to search row numbers 72 to 112, for values greater than 0.54. I want to then use these indices to give these points a different color in my scatter plot. I am currently using find:
ind2 = find(T{72:112,8} > 0.5426) %Correctly classified test points
ind3 = find(T{113:143,8} < 0.5426) %Correctly classified test points
scatter(X1(ind1),Y1(ind1),'b','filled') %Cal data is blue
scatter(X1(ind2),Y1(ind2),'g','filled') %Correctly classified data is green
scatter(X1(ind3),Y1(ind3),'g','filled') %Correctly classified data is green
scatter(X1(69),Y1(69),'k','filled')
hold off
The ind2 output is : 1 2 4 5 6 8 10 etc
i.e. it tells me that starting from the 72nd row, the 1st value meets my criteria (> 0.54), the 2nd does, the 3rd does not and so on, which I verified is correct. But I want to now the row index, in order to shade the accurate points in the plot!
The find works fine with variables, i.e. it outputs the row number. I don't know the issue with tables :(
Please help!

回答 (1 件)

Chaitanya Mallela
Chaitanya Mallela 2020 年 8 月 18 日
Try the code by adding (initial index - 1) to the find function
ind = find(T{initial_index:final_index,column_index} > threshold) + (initial_index - 1)

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by