matlab::cpplib::initMATLABApplication
Start the MATLAB Runtime and initialize its application state
Description
std::shared_ptr<MATLABApplication>
initMATLABApplication(matlab::cpplib::MATLABApplicationMode mode, const
std::vector<std::u16string>& options =
std::vector<std::u16string>())
matlab.cpplib.initMATLABApplication
accepts as input mode and an
optional array of startup options. It returns a shared pointer to a
MATLABApplication
object. The shared pointer is passed to the
function matlab::cpplib::initMATLABLibrary
, which returns a unique pointer to a
user written library. This unique pointer is then used to call MATLAB® functions from the library
A process should call this method only once.
Parameters
MATLABApplicationMode mode | Mode in which to start application:
|
const std::vector<std::u16string>&
options | Start up options used to start a MATLAB Runtime. They include:
|
Return Value
| Pointer to a |
Exceptions
| The function failed to start. |
Examples
Start MATLAB Runtime In-Process, with Default Runtime Options
std::shared_ptr<MATLABApplication> appPtr = initMATLABApplication(MATLABApplicationMode::IN_PROCESS);
Start MATLAB Runtime Out-Of-Process, Without a Java Virtual Machine
std::vector<std::string> opts = {"-nojvm"}; std::shared_ptr<MATLABApplication> appPtr = initMATLABApplication(MATLABApplicationMode::OUT_OF_PROCESS, opts);
Start MATLAB Runtime In-Process, and Generate a Log File
std::vector<std::u16string> opts = {u"-logfile", u"C:\\somepath\\matlab_app.log"}; std::shared_ptr<MATLABApplication> appPtr = initMATLABApplication(MATLABApplicationMode::IN_PROCESS, opts);
Version History
Introduced in R2018a
See Also
matlab::cpplib::runMain
| matlab::cpplib::convertUTF8StringToUTF16String
| matlab::cpplib::convertUTF16StringToUTF8String
| matlab::cpplib::initMATLABLibrary
| matlab::cpplib::initMATLABLibraryAsync
| matlab::cpplib::MATLABLibrary::feval
| matlab::cpplib::MATLABLibrary::fevalAsync
| matlab::cpplib::MATLABLibrary::waitForFiguresToClose