Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
how to select a randomly from the matrices?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have 7 matrices every time, but I do not know how many rows there are in the matrices because rows are randomly inserted into the matrices. I want to choose one row in each of the 7 matrices randomly every time.
Thanks in advance
댓글 수: 0
답변 (1개)
James Tursa
2015년 3월 26일
To select a random row from a matrix:
the_matrix = your matrix
the_random_row = the_matrix(randi(size(the_matrix,1)),:);
댓글 수: 2
Image Analyst
2015년 3월 27일
I don't see that that matters. Please give an example. Are your 7 matrices in a cell array, with 7 cells and one matrix in each cell? If so, use Stephen's answer. If they're separate matrices with separate unique names, use James's Answer. Otherwise, please give a sample of what form your data is in, and an example of the output you would like to get.
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!