MATLAB: Select random number from a 3D matrix

random select

How to select 870 values from an assigned matrix
class = 23x256x144244
select 870 valuse randomly from 144244 to get
new_class = 23x256x870

Best Answer

  • new_class=class(:,:,randperm(144244,870));%as long as you have enough memory