Filter löschen
Filter löschen

Split a vector into two vectors randomly

2 Ansichten (letzte 30 Tage)
neamah al-naffakh
neamah al-naffakh am 22 Dez. 2016
Bearbeitet: neamah al-naffakh am 23 Dez. 2016
hi, I have a vector that has 36 values and I'd like to split it into two vectors randomly. ( the first vector has 25 values and the second has 11 values ).
I have written this code but when i have repeated values in the original vector, i will not get 11 samples in the second vector because of this command
I really appreciate any help guys. Kind Regards.

Akzeptierte Antwort

Roger Stafford
Roger Stafford am 22 Dez. 2016
Bearbeitet: Roger Stafford am 22 Dez. 2016
Why not do this:
t = original_vec(randperm(Total_Samples));
First_vec = t(1:25);
Second_vec = t(26:36);

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by