Help in shuffle test data ?

2 vues (au cours des 30 derniers jours)
Redouane Bouchou
Redouane Bouchou le 9 Avr 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 .

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by