MATLAB: How to export from a GUI (.exe) to MATLAB workspace

export

Hi, Can anyone guide me how to export a created array in a GUI(.exe) to the MATLAB '*base*' workspace? Note: by GUI(.exe), I mean I've created a GUI .exe file using '*deploytool*'. If I run my GUI .m file (or .fig file using 'guide') I can use '*assignin*' function to do this export. But the mention function does not work if I run my .exe GUI. Should I run MATLAB from .exe GUI?
Thank you so much

Best Answer

The .exe has its own base workspace that you can assign in to all you like, but it will vanish as soon as the executable ends -- just like happens if you were to do something in MATLAB and then exit MATLAB.
Running MATLAB from the .exe wouldn't help much, in the sense that the .exe would not be able to make assignments in to the workspace of the live MATLAB.
The .exe could save() variables in to a .mat file, and you could load() the .mat file.