Assignin variables in a stand-alone application

I have a GUI with a button that uses the assignin() function to send variables to the 'base' for debug and analysis purposes when running the code in Matlab. What happens to these variables when the application is run as a stand-alone version? Should I disable the button when compiled as a stand-alone? Is there a test I can perform to determine if the button should be disabled or enabled?

3 件のコメント

Geoff
Geoff 2012 年 6 月 4 日
By 'compiled', you mean actually compiled with the MatLab Compiler? GUI functionality is not available in such applications.
Walter Roberson
Walter Roberson 2012 年 6 月 4 日
GUI functionality _is_ supported with MATLAB Compiler. GUI functionality is not, however, supported with MATLAB Coder.
John Petersen
John Petersen 2012 年 6 月 4 日
I mean compile with the Matlab compiler as a stand-alone application that uses the matlab engine. I'm not generating C code.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2012 年 6 月 4 日

0 投票

The variables still get assigned to the base workspace. The base workspace would get destroyed (along with all other workspaces) when the standalone application exited, but the variables can be used until that point.
If it does not make sense in your context to be able to save those variables in stand-alone mode, use isdeployed()

4 件のコメント

John Petersen
John Petersen 2012 年 6 月 5 日
How would it ever make sense to save variables in the base workspace in a stand-alone mode?
Walter Roberson
Walter Roberson 2012 年 6 月 6 日
The base workspace can be accessed anywhere in the code by using evalin() or assignin() . There are a lot of different things that one might want to store there. (There are alternatives, but using the base workspace is often simpler.)
John Petersen
John Petersen 2012 年 6 月 6 日
So placing variables in the base workspace makes them essentially global variables?
Walter Roberson
Walter Roberson 2012 年 6 月 6 日
"global variables" would be one way of looking at it, but the base workspace is distinct from the workspace of global variables.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 6 月 22 日

0 投票

My previous answer might have been wrong about the base workspace existing in compiled applications. I am having difficulty finding documentation on this matter, but it is implied by Loren in http://blogs.mathworks.com/loren/2010/11/18/deploying-standalone-applications/ and in a small number of ambiguous cssm postings .
(Some day I'm going to be able to afford to get a MATLAB Compiler license and try these things myself... But it probably won't be soon.)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by