Azzera filtri
Azzera filtri

How to get the row numbers from a chart.

5 visualizzazioni (ultimi 30 giorni)
zhengwen liu
zhengwen liu il 22 Mar 2021
Risposto: SSM il 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 Commento
Pavan Guntha
Pavan Guntha il 26 Mar 2021
Can you elaborate on what is chart being referred to in the question ?

Accedi per commentare.

Risposte (1)

SSM
SSM il 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

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by