Transpose a matrix when using eval
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kyriacos
el 21 de Mzo. de 2012
Editada: per isakson
el 16 de Feb. de 2017
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 comentarios
Respuesta aceptada
Friedrich
el 21 de Mzo. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!