How to generate random matrix from another one?
Afficher commentaires plus anciens
Hi!
I have a 18 x 57x11 matrix .
How can I make a new random matrix (the same size) , which is generated by "shuffling" the values of the original matrix?
A lot thanks in advance!
1 commentaire
Ha! You got 3 different approaches that use randperm() and reshape().
By the way, your data is not a matrix. A matrix is 2 dimensional, with rows and columns. Your data contains a 3rd dimension which makes it an array. All 3 answers will work no matter how many dimensions are in the input.
Réponse acceptée
Plus de réponses (2)
Bruno Luong
le 19 Sep 2019
A is your input matrix
Ashuffle = reshape(A(randperm(numel(A))),size(A))
1 commentaire
IM
le 20 Sep 2019
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!