Organize matrix in a random way

2 次查看(过去 30 天)
Hello, i have a matrix,H which have N rows and n columns.lets say N = 20 and n is 3. i would like to rearange only the rows in H, in a radom way. but keep every element in the say column he was before. so that h(1,:) will be moved to a radom place h(random number,:)
is there a built in function than can do this?
i think i know how to di it by my self, but can find anything bulit in.
thank u!

采纳的回答

Matt J
Matt J 2021-4-28
N=size(H,1);
H=H(randperm(N),:);
  3 个评论
Matt J
Matt J 2021-4-28
You're welcome, but please Accept-click the answer to indicate that it resolved the question.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by