MATLAB: How to extract random elements from an array

array

For eg., I have a 1d array, d=[1;3;4;6;8;7;8;9;6;7] and I need to extract the first, third and sixth variable. How do I do that?

Best Answer

d([1 3 6])
If you want 3 at random then,
d( randperm(length(d),3) )