Réponse acceptée

Kristi
Kristi le 14 Fév 2016
A = repmat(1:6, [1 4])
B = A(randperm(24))

1 commentaire

B = A(randperm(numel(A))
would be a lot better since it will work regardless of the size of A. As a rule avoid hardcoded constants, particularly as it's trivial to obtain the number of elements in A.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by