Effacer les filtres
Effacer les filtres

how to set matrix from data

1 vue (au cours des 30 derniers jours)
yu yue
yu yue le 15 Oct 2016
Commenté : Walter Roberson le 15 Oct 2016
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] ?

Réponse acceptée

Walter Roberson
Walter Roberson le 15 Oct 2016
sn = 6; en = 2;
m = zeros(1, max(sn,en));
m(sn) = -1;
m(en) = 1;
  2 commentaires
yu yue
yu yue le 15 Oct 2016
Modifié(e) : yu yue le 15 Oct 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]
Walter Roberson
Walter Roberson le 15 Oct 2016
m = zeros(1,6);

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by