MATLAB: Do I receive an error when I run a GUI containing an ActiveX control compiled using the MATLAB Compiler 4.0 (R14)

activexcomcompilercontroldirectoryfailedfileguiledMATLABMATLAB Compilernotobjectrestoredsameserializationstate

I have a GUI called mygui created using GUIDE that contains an ActiveX control. When I save the GUI and run it, the corresponding mygui_activex file gets created in the current directory. I compile the GUI using the following command:
mcc –m mygui.m
When I execute the EXE-file, I receive the following error in an error dialog:
Serialization of COM object failed. ‘LED activex control’ could not be restored to its previous state. Make sure file mygui_activex1 is in the same directory as your GUI.

Best Answer

This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, read below for any possible workarounds:
There is a bug in MATLAB Compiler 4.0 (R14) in the way that it locates the activex files corresponding to a GUI. To work around this issue, use the -a flag to append the mygui_activex file to the CTF-archive when compiling:
mcc –m mygui.m -a mygui_activex