I have a path from node 6 to node 2, how can i can get the matrix like this [0 1 0 0 0 -1] ?

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 15 Okt. 2016

0 Stimmen

sn = 6; en = 2;
m = zeros(1, max(sn,en));
m(sn) = -1;
m(en) = 1;

2 Kommentare

yu yue
yu yue am 15 Okt. 2016
Bearbeitet: yu yue am 15 Okt. 2016
hi. If I have 6 node, but the path is from 3 to 5, how can I get [0 0 -1 0 1 0]? I only get [0 0 -1 0 1]
m = zeros(1,6);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by