The Connect method allows you to control when and how MatLab gets initially launched.

Before any Library operation are preformed, you must connect the Library to MatLab.

Before you Connect you will want to define the base object reference, shown here as "Lib", as discussed in the Setup.

Lib.Connect [Desktop]

Desktop:  (Optional Boolean) True, False (default)

If MatLab has not been previously started as an automation client then there will be a considerable delay as it is started.

Once you have connected, additional calls to connect will simply use the existing connection.

The Library does not need to use the MatLab user interface but if you want to launch the normal MatLab desktop you can manually type into the MatLab command window 'desktop'.

Optionally, you can set the "Desktop" startup parameter when you Connect.  Keep in mind that launching the MatLab desktop adds considerably to the initial startup time.

Note that any library operation that needs to use MatLab will check for an active connection and will start MatLab as needed so it is always better to control the initial connection process to avoid unexpected delays.