Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
jaah navi
jaah navi le 5 Juin 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
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.

Réponses (1)

TADA
TADA le 5 Juin 2019
Modifié(e) : TADA le 5 Juin 2019
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 commentaires
TADA
TADA le 5 Juin 2019
well, that cannot be understood from your question
TADA
TADA le 5 Juin 2019
also that makes this question a duplicate if im not mistaken....

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by