필터 지우기
필터 지우기

how to set matrix from data

조회 수: 1 (최근 30일)
yu yue
yu yue 2016년 10월 15일
댓글: Walter Roberson 2016년 10월 15일
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일
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]
Walter Roberson
Walter Roberson 2016년 10월 15일
m = zeros(1,6);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by