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] ?

 채택된 답변

Walter Roberson
Walter Roberson 2016년 10월 15일

0 개 추천

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

댓글 수: 2

yu yue
yu yue 2016년 10월 15일
편집: yu yue 2016년 10월 15일
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);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2016년 10월 15일

댓글:

2016년 10월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by