I have a 2 by 26 matrix, how do i randomly select one of the rows and extract them?

조회 수: 4 (최근 30일)
shiptext= [22 6;38 21;24 36;2 30;6 2;15 31;22 15;24 15;10 33;29 11;32 15;29 21;31 4;25 27;29 27;10 11;35 17;15 14;22 20;21 29;23 22;3 22;33 9;8 38;10 4;11 29]
  댓글 수: 1
Stephen23
Stephen23 2020년 3월 15일
편집: Stephen23 2020년 3월 15일
Your example matrix has size 26x2. In MATLAB matrix sizes are given as rows*columns (just like in mathematics).

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

채택된 답변

Stephen23
Stephen23 2020년 3월 15일
idr = randi(26,1,1);
row = shiptext(idr,:)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by