Effacer les filtres
Effacer les filtres

create symbolic variables

2 vues (au cours des 30 derniers jours)
Artur M. G. Lourenço
Artur M. G. Lourenço le 8 Nov 2011
My problem is the following:
if I have an array ij then have to create variables ij.
ex.:
a = [ 1 2; 3 4]
then
b = [x11 x21;x12 x22]
have to create the variables corresponding to the size of the matrix.
These variables can be syms or string. Can I convert the string to syms after.
thanks advanced
  1 commentaire
Artur M. G. Lourenço
Artur M. G. Lourenço le 8 Nov 2011
in fact there str2sym. Sorry

Connectez-vous pour commenter.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 8 Nov 2011
a = [1 2;3 4];
x = sym('x%d%d',size(a)).'
please read: doc sym

Plus de réponses (1)

Artur M. G. Lourenço
Artur M. G. Lourenço le 8 Nov 2011
My god, I ask my five excuses. Always read the doc before asking a question and this time I have not read. Thank you, this is not repeated.
  2 commentaires
Walter Roberson
Walter Roberson le 8 Nov 2011
Though to be fair, this feature is new in R2011b. (Or was it R2010b?)
Artur M. G. Lourenço
Artur M. G. Lourenço le 11 Nov 2011
true

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by