Matlab, Change order in a cell array randomly -
Is it possibly to change the order of a cell array with a function, or I shoudl another way around ?
Use:
& gt; & Gt; MyCell = {'a', 23, [3 4 5], 'BBB'} myCell = 'a' [23] [1x3 double] 'BBB' & gt; & Gt; MyCell (:) = myCell (randperm (numel (myCell))) myCell = 'bbb' 'a' [1x3 double] [23]
Also for n-dimensional cell arrays Works:
& gt; & Gt; MyCell = {1, 2; 'A', 'b'} myCell = [1] [2] 'A' 'B' & gt; & Gt; MyCell (:) = myCell (randperm (numel (myCell))) myCell = [1] 'A' 'b' [2]
Comments
Post a Comment