Effacer les filtres
Effacer les filtres

How to get the row numbers from a chart.

5 vues (au cours des 30 derniers jours)
zhengwen liu
zhengwen liu le 22 Mar 2021
Réponse apportée : SSM le 26 Mar 2021
We have a chart to work on, which has over 20000 rows. We want to get the row numbers for the rows which have values over 200.
we used
for i = 1:numel (num(;,3))
if num(i;3) >= 200
end
end
what code should we add in the blank row.
Thank you.
  1 commentaire
Pavan Guntha
Pavan Guntha le 26 Mar 2021
Can you elaborate on what is chart being referred to in the question ?

Connectez-vous pour commenter.

Réponses (1)

SSM
SSM le 26 Mar 2021
If I understand your question correctly, then you don't need to write a loop to get the row numbers.
Instead, use find() function.
Example:
%%% Sample data
A = 400*rand(1,100)'; % This creates a column with 100 values randomly distributed between 0 to 400.
%%% Need to find row numbers of data greater than 200
rows = find(A > 200); % Returns the row numbers of values greater than 200.
%%% If you want the values greater than 200 in another variable
B = A(rows); % Returns all the values of A gretaer than 200 as a new variable B

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by