简体   繁体   English

Matlab:混合输入向量

[英]Matlab: Mix Input vector

Hey there, is there any way to 'mix up' the order of the elements of an input vector in matlab randomly?嘿,有什么方法可以随机“混合” matlab 中输入向量的元素顺序? Say I input说我输入

[1:5]' [1:5]'

I wanna get out for example:例如,我想出去:

[3 5 1 2 4]' [3 5 1 2 4]'

thanks!谢谢!

Use RANDPERM :使用RANDPERM

shuffledOutput = inputVector(randperm(length(inputVector)));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM