필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Could anyone help me how to randomly display the values in the selected places

조회 수: 1 (최근 30일)
jaah navi
jaah navi 2019년 6월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
Could anyone help me how to randomly display the values in any of the selected places
1
3
4
5
8
9
10
11
13
15
of (3,5) matrix under the condition that under the condition that every rows and columns should be selected with one above mentioned places.

답변 (1개)

TADA
TADA 2019년 6월 5일
편집: TADA 2019년 6월 5일
if you meant to fetch values from a random index using above mentioned linear indices:
a = magic(5);
a = a(1:3,:);
validIndices = [1,3,4,5,8,9,10,11,13,15];
i = validIndices(randperm(numel(validIndices),1));
x = a(i)
but if you meant to use them as subsets (i.e a(i,j)), you have a problem, because these subsets are larger than your specified matrix, and will almost always result in an error
  댓글 수: 3
TADA
TADA 2019년 6월 5일
well, that cannot be understood from your question
TADA
TADA 2019년 6월 5일
also that makes this question a duplicate if im not mistaken....

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by