Filter löschen
Filter löschen

How to get the row numbers from a chart.

5 Ansichten (letzte 30 Tage)
zhengwen liu
zhengwen liu am 22 Mär. 2021
Beantwortet: SSM am 26 Mär. 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 Kommentar
Pavan Guntha
Pavan Guntha am 26 Mär. 2021
Can you elaborate on what is chart being referred to in the question ?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

SSM
SSM am 26 Mär. 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

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by