Effacer les filtres
Effacer les filtres

Form strings/numbers from matrix

2 vues (au cours des 30 derniers jours)
Natialol
Natialol le 31 Mar 2013
Hello,
Looking for a way to join the horizontal elements of a matrix into a number.
[1 2 0; 0 2 6; 9 8 0; 0 0 2] to form [120; 026; 980; 002]
or {120,026,980,002}
Thanks

Réponse acceptée

Cedric
Cedric le 31 Mar 2013
Modifié(e) : Cedric le 31 Mar 2013
If you want numbers:
>> A = [1 2 0; 0 2 6; 9 8 0; 0 0 2]
A =
1 2 0
0 2 6
9 8 0
0 0 2
>> A * [100;10;1]
ans =
120
26
980
2
and you can convert to string from there if needed.
  1 commentaire
Natialol
Natialol le 31 Mar 2013
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by