Repeating string variables to form a new string variable
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
Hello to all
I`m estimating a VAR and I want to export some results in an Excel sheet. I want to add column names direct from matlab and I did this already. However, the way my VAR is estimated, I need that my column name variable to be of size (1,nvar^2+1), where nvar is the number of variables in the system.
I created a variable called var_names = ['var1', 'var2','var3']; which contains the labels for the variables names.
In this case, where I have 3 variables, I want:
col_names = ['Horizon' var_names var_names var_names];
My question is: How to automatize this repetition? I want this to be a function of nvar so when I estimate a different model with different number of variables I do not have to change this code, so I would have something like:
col_names = ['Horizon' var_names times nvar];
Thank you all in advance.
Respuestas (1)
James Tursa
el 13 de Jul. de 2016
doc repmat
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!