Effacer les filtres
Effacer les filtres

Info

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

Could anyone help me to solve the issue in the following code:

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
code:
a=[4.1288 5.2574 0 4.9757 3.0069;
0 3.7672 4.7411 3.4989 0;
4.7132 0 4.0136 0 4.9751]
siz = size(a)
result1=randi(3,1,5)
val_list=1:3
while ~all(ismember(val_list,result1))
result1=randi(3,1,5)
end
idx1 = sub2ind(siz, result1, 1:siz(2))
C1 = zeros(siz)
C1(idx1) = a(idx1)
D=sum(C1,2)
When i run the code it executes and gives me the result.
But what i actuallu need is with respect to the command line
C1(idx1) = a(idx1)
i need to have one nonzero value with respect to every row and column.
But when i run the code it gives me the result in such a way all values in any of the row or column becomes zero.
Could anyone please help me on this.
  2 commentaires
jaah navi
jaah navi le 5 Juin 2019
As no answers were provided i made it in different way.
Rik
Rik le 5 Juin 2019
Only two hours passed between you posting this question and concluding that you don't get an answer. If your work is so time-sensitive and important that you can't wait, why don't you hire a consultant to do this?

Réponses (0)

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