Page 1 of 1

Flexible number of arguments

Posted: Mon Mar 19, 2018 11:43 am
by tho_mi
Hey,

I have a program that extracts certain information of different matrices. I want it to be flexible and take as many matrices as the user wants. Is there a way to use a "flexible" number of arguments and let the program figure out how many arguments it got?

Thanks in advance!

Best,
Thomas

Re: Flexible number of arguments

Posted: Mon Mar 19, 2018 12:35 pm
by EViews Gareth
All EViews programs have a flexible number of arguments, so it isn't really clear what you're asking.

Re: Flexible number of arguments

Posted: Mon Mar 19, 2018 1:12 pm
by startz
If you are running a program, %arg is a string with all the arguments separated by spaces. There isn't an equivalent for subroutines. It might be nice to have the equivalent of Matlab's nargin and vargin, but I don't think EViews has one.

Re: Flexible number of arguments

Posted: Mon Mar 19, 2018 2:22 pm
by tho_mi
All EViews programs have a flexible number of arguments, so it isn't really clear what you're asking.
Sorry, should've formulated my question in a different way. My question was more about finding out how many arguments the user passed to the program.
If you are running a program, %arg is a string with all the arguments separated by spaces. There isn't an equivalent for subroutines. It might be nice to have the equivalent of Matlab's nargin and vargin, but I don't think EViews has one.
Thanks, that really helps. I'll just use @wcount to get the number of arguments and then extract them (using @word).