MATLAB: How to allocate a matrix less than 1 to a variable

matlab code matrix easy basics allocation if for while

So lets say I have matrix a = [.2 , .3 , 2 , 5 , .7 , 8]
I want to allocate all values of a <= 1 to a variable b. so b should contain .2, .3, .7
How do I do this?

Best Answer

a = [.2 , .3 , 2 , 5 , .7 , 8]
b=a(a<=1)