How to get the row numbers from a chart.
1 次查看(过去 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 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!