Help in shuffle test data ?

1 view (last 30 days)
Redouane Bouchou
Redouane Bouchou on 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 .

Accepted Answer

Peng Li
Peng Li on 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 Comment
Redouane Bouchou
Redouane Bouchou on 9 Apr 2020
exactly , that's what i wanted , thank you very mush , that was very helpfeul

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!