Transpose a matrix when using eval
12 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Friedrich
on 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 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!