input parameters of standalone application

6 views (last 30 days)
Marzi
Marzi on 9 Nov 2015
Answered: Walter Roberson on 10 Nov 2015
I have an standalone application (.exe file) and uses MCR to be executed. When I run the exe file, a window pops up and ask the input parameters (filename, some other parameters). I want to run it on lots of files so I need to run it in a batch. However, I do not know how to pass the parameters to it in a commandline (without pops up window). Is there any way to do it?

Answers (1)

Walter Roberson
Walter Roberson on 10 Nov 2015
The difficulty of doing that is going to depend upon the way it is coded to do the prompting, which you have not specified.
In the general case you might have to use something like the Java Robot Class to simulate key presses and button clicks on top of the forms that your program pops up. But if you have control over the source of the program then you would generally instead modify the code a little to get it to understand command line parameters.
When you invoke a compiled executable, then anything you type on the command line is passed a string parameters to the main function, the one which you instructed MATLAB to compile. You can use nargin and varargin to examine the arguments. Keep in mind that they will all be strings, so if any of them are to be interpreted as numbers, str2double() the corresponding value.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!