How to get the row numbers from a chart.

5 次查看(过去 30 天)
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 个)

SSM
SSM 2021-3-26
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

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by