Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Compiler   

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.

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;
}
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS