Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
jaah navi
jaah navi el 5 de Jun. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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 comentarios
jaah navi
jaah navi el 5 de Jun. de 2019
As no answers were provided i made it in different way.
Rik
Rik el 5 de Jun. de 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?

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by