Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Organizing data to use Graphshortestpath function

2 ビュー (過去 30 日間)
Kim
Kim 2012 年 5 月 3 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I know the concept behind Graphshortestpath Function in Matlab however I have to re-code this portion to connect the path again.
W = [44.35 45.84 41.19 23.81 59.86 68.63 29.99 24.13 47.3 30.36 500];
DG = sparse([1 2 3 4 5 6 7 8 9 10 11],[2 3 4 5 6 7 8 9 10 11 1],W);
UG = tril(DG + DG');
Is there other way that I can make my life easier?? I have a huge data that require to input into the system and my data are in Excel format. I can't possibly re-code this every single time. Really appreciate your help! Thanks :)

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 5 月 3 日
Perhaps I am missing what you are asking?
DG = sparse(1:length(W), [2:length(W), 1], W);
  3 件のコメント
Walter Roberson
Walter Roberson 2012 年 5 月 3 日
N1 = 1 : length(W);
N2 = circshift(N1,[0 -1]);
Then store appropriate adjustments in N2, such as N2(93) = 17;
Afterwards,
DG = sparse(N1, N2, W);
Kim
Kim 2012 年 5 月 3 日
Not really sure how to store N2.
But can I do some adjustment to the excel data itself only by arranging the way it should be connected and separate it by a empty row in between.
I not sure whether it is feasible??

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by