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

조회 수: 18 (최근 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 CenterFile Exchange에서 Dimensionality 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