Transpose a matrix when using eval
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have a programming question. Effectively, I am not sure how I could use the transpose of a vector/matrix within an "eval" command since transposing involves the sign " ' ". What I mean: I want to execute the following command:
ARp0(1,:)= autoreg(var1_0(1, :)',pl, 1) ;
It does not really matter what it means, just note that I use the row-vector var1_0(1,:) which is transposed to give me a column vector. Now, I want to execute that using "eval" so that it automatically adjusts the zeros in the variable names (for some variable k). That would be:
eval[('ARp', num2str(k), '(1,:)= autoreg(var1_', num2str(k), '(1, :)',pl, 1)']) ;
You see that the " ' " sign (just before pl) is meant to be the transpose-sign, but it intervenes with the eval function.
How can I cope with this problem? Thanks!
Kyriacos
0 commentaires
Réponse acceptée
Friedrich
le 21 Mar 2012
Hi,
you can do it like this:
eval('ARp0(1,:)= autoreg(var1_0(1, :)'',pl, 1);')
Or use the transpose function:
eval('ARp0(1,:)= autoreg( transpose(var1_0(1, :)),pl, 1);')
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing 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!