Conditional Data Selection

 
V = rand(8,1)
>>
  0.6501
  0.3218
  0.8069
  0.2689
  0.2224
  0.5708
  0.8222
  0.0034
I = V < 0.5
>>  % 8×1 logical array
  0
  1
  0
  1
  1
  0
  0
  1
V([1,2,3])
>>
  0.6501
  0.3218
  0.8069
V(I)
>>
  0.3218
  0.2689
  0.2224
  0.0034
V(I) = 0
>>
  0.6501
       0
  0.8069
       0
       0
  0.5708
  0.8222
       0