Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

2 次查看(过去 30 天)
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 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by