Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How can I create a matrix with the results of a disp function?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
J = [0 3 4;3 0 8;4 8 0];
for i =1:numel(J)
[i,j] = ind2sub(size(J),find(triu(J==i)));
disp([i j])
end
I have the above code and as a result I get 1 2 ; 1 3; 2 3, which are the positions of the elements 3,4 and 8 respectively. I want to get the position in decreasing order, that is firstly for the 8--> 2-3,next for the 4--> 1-3 and lastly 3--> 1-2.
How can I create a matrix M having the form of:
M=[8 2 3
4 1 3
3 1 2]
Thank you in advance.
0 comentarios
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!