How to select real positive number ?
24 views (last 30 days)
Show older comments
How do I pick up only real positive numbers from array or matrix which has all types of numbers such as positive ,negative real numbers and complex numbers?
I tried A(A>0) but it returns positive number but also complex numbers whose real part is positive.
For example, A=[1,-3,4,1+2i,5-3i,-9-i,9+3i];
B=A(A>0)
then I got
B=[1,4,1+2i,5-3i,9+3i]
But how do I get B=[1,4]?
Thanks
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!