Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How can I create a matrix with the results of a disp function?

1 Ansicht (letzte 30 Tage)
giorgos kazas
giorgos kazas am 4 Feb. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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.

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by