Help in shuffle test data ?

1 Ansicht (letzte 30 Tage)
Redouane Bouchou
Redouane Bouchou am 9 Apr. 2020
Hello ,
I need help in matlab , this sounds easy but i can not seem to find a solution , here is an example :
data = [1 0.1
2 0.2
3 0.3
4 0.4
5 0.5
6 0.6 ]
i want to shuffle the test data , i mean the first line become the third line and the third line becoms the forth line for examle , but the order in the line remaind the same
Here is an example of how i want the data to become :
data = [1 0.1
6 0.6
2 0.2
5 0.5
4 0.4
3 0.3 ]
is there a matlab function that allows me to do that , and thanks in advance .

Akzeptierte Antwort

Peng Li
Peng Li am 9 Apr. 2020
"he first line become the third line and the third line becoms the forth line"
your example doesn't meet what you described.
I guess you want do a random shuffling of data by rows.
newData = data(randperm(6), :)
newData =
4.0000 0.4000
1.0000 0.1000
6.0000 0.6000
5.0000 0.5000
2.0000 0.2000
3.0000 0.3000
  1 Kommentar
Redouane Bouchou
Redouane Bouchou am 9 Apr. 2020
exactly , that's what i wanted , thank you very mush , that was very helpfeul

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by