Find index of specific rows of a table with value greater than a threshold
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
0 Kommentare
Antworten (1)
Chaitanya Mallela
am 18 Aug. 2020
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)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!