Macro-processor language and loops

No, that is not possible, but you can use Matlab variables outside of the mod-file and pass them to the mod-file to set preprocessor variables. That should to the trick. This can be done with the -D switch in the command line. See [Loop over certain antizipation horizons)