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!