how to mix data randomly

9 次查看(过去 30 天)
Jay Hanuman
Jay Hanuman 2016-11-8
编辑: KSSV 2016-11-8
I have two data set A and B with both length equal to 40. I want to mix data A and B randomly. how to do it.

回答(1 个)

KSSV
KSSV 2016-11-8
编辑:KSSV 2016-11-8
A = rand(40,1 ); % some random data
B = rand(40,1) ; % some random data
% combining
C = [A ; B] ; % join A and B
C = C(randsample(1:80,80)) ; % shuffle randomly
You can shuffle randomly A, B and merge also..

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by