how to mix data randomly

8 vues (au cours des 30 derniers jours)
Jay Hanuman
Jay Hanuman le 8 Nov 2016
Modifié(e) : KSSV le 8 Nov 2016
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.

Réponses (1)

KSSV
KSSV le 8 Nov 2016
Modifié(e) : KSSV le 8 Nov 2016
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..

Catégories

En savoir plus sur Random Number Generation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by