Reputation: 155
I want to get A'=[1 0 3 0]'
from A=[1 10 3 100]'
from the below MATLAB code
new_A=A(A<10)
But it does not work.
I need to do this without for
or if
.
Upvotes: 0
Views: 86
Reputation: 656
(A < 10)
is a binary matrix of the same size as A
. Thus this should do the job:
A .* (A < 10)
Upvotes: 5