Hi to all,
I am using the new macrolanguage to write loops within a .mod file and is working fine in general.
However, the problem is that one cannot use a variable previously defined to set anything in the macrolanguage. For example, one may want to set the loop range from the size a vector previously defined (or loaded from another exercise), but this is not possible.
That is, if for example you want to define a number of variables using a loop, you may write
@#define n_type = [1:2]
@#for type in n_type
g_@{type}
@#endfor
and it works fine, creating two variables with the names g_1 and g_2
However, if you write instead
load xvector.mat;
@#define n_type = [1:size(xvector,1)]
@#for type in n_type
g_@{type}
@#endfor
It will give you an error message:
ERROR in macro-processor: file.mod: Unknown variable: size
That is, the macrolanguage does not accept any input from outside of itself.
Why is this? Can this be solved?
Thanks for your help,
Pablo