필터 지우기
필터 지우기

Help in shuffle test data ?

조회 수: 5 (최근 30일)
Redouane Bouchou
Redouane Bouchou 2020년 4월 9일
댓글: Redouane Bouchou 2020년 4월 9일
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 .

채택된 답변

Peng Li
Peng Li 2020년 4월 9일
"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
Redouane Bouchou
Redouane Bouchou 2020년 4월 9일
exactly , that's what i wanted , thank you very mush , that was very helpfeul

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by