Repeating string variables to form a new string variable
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
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.
0 个评论
回答(1 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!