mclSetCmdLineUserData - Associate MATLAB data value with string key of MCR instance uniquely identified by mcrID
Synopsis
extern "C"
size_t mclSetCmdLineUserData(
long mcrID,
int argc,
const char **argv
);
Description
This external C function examines the arguments on the command
line for the switch -mcruserdata and calls mclSetMCRUserData on
the argument of any such switches that it finds. It then returns
the new size of argv (the new value for argc).
MCR user data is specified on the command line using the -mcruserdata switch,
as in the following example:
% myapp -mcruserdata
"ParallelConfigurationFile:/usr/userdir/config.mat"Users
may pass MCR user data to an application on the command line with
the -mcruserdata switch. The switch argument syntax
is key:value, where both key and value are
strings. The key string may not contain any colons, but the value
string may contain them. The string is split into key and value at
the first colon. Multiple switches may appear on a command line.
Caution
Be aware that all standalone applications attempt to parse the
command line. Use the -mcruserdata switch with
great care. |
Note
The generated main function for a C/C++ application changes
to call mclSetCmdLineUserData after initializing
the MCR. Generated code for a software component or shared library
does not change. It is the user's responsibility to call mclSetMCRUserData after
calling the library initialization function. |
Note
A compiled application should set mcruserdata ParallelConfigurationFile before calling
any Parallel Computing Toolbox code. Once this code has been called,
setting ParallelConfigurationFile to point to a
different file has no effect. |
This command is part of the MCR User Data interface API. For
information about this function, as well as complete examples of usage,
see Improving Data Access Using the MCR User Data Interface.
Examples
Call using this basic structure:
int run_main(int argc, const char **argv)
{
// Other run_main code here ...
// Get -mcruserdata switches from the command line
size_t dataCount =
mclSetCmdLineUserData(_mcr_inst, argc, argv);
_retval = mclMain(_mcr_inst, argc, argv, "tctf", 0);
// Other run_main code here ...
}
Use the following code sample as a reference:
int run_main(int argc, const char **argv)
{
int _retval;
/* Generate and populate the path_to_component. */
char path_to_component[(PATH_MAX*2)+1];
separatePathName(argv[0],
path_to_component, (PATH_MAX*2)+1);
__MCC_tctf_component_data.path_to_component =
path_to_component;
if (!tctfInitialize()) {
return -1;
}
size_t dataCount =
mclSetCmdLineUserData(_mcr_inst, argc, argv);
_retval = mclMain(_mcr_inst, argc, argv, "tctf", 0);
if (_retval == 0 /* no error */)
mclWaitForFiguresToDie(NULL);
tctfTerminate();
mclTerminateApplication();
return _retval;
}
 | mclKillAllFigures | | mclSetMCRUserData |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit