MATLAB: How to sort out negative and positive values of a vector

loopmathematical

if A= -3 -2 -1 0 1 2 3 i want to sort the negative values and positive values in a separate vector

Best Answer

A=[ -3 -2 -1 0 1 2 3 ]
Negative_nos = sort(A(A<0))
Positive_nos = sort(A(A>=0))
Will do the trick