How to create a vector of all elements in another vector that meet a certain condition?

2 次查看(过去 30 天)
I have a vector, A, of 1000+ data points, and I want to create a new vector, A_pos, that contains only the positive values for that vector.
How can I do this?

回答(1 个)

Thorsten
Thorsten 2017-4-4
A_pos = A(A>0);

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by