フィルターのクリア

App Designer: App runs from Matlab but not after Compiler

14 ビュー (過去 30 日間)
Dominik Müller
Dominik Müller 2020 年 10 月 12 日
編集済み: Dominik Müller 2020 年 10 月 12 日
Hi everyone,
I have an app created in App Designer. If I run it directly from Matlab/App Designer everything works perfect. But after I used Matlab Compiler the app doesn't work anymore. In my startup function I call this function
app.Config = ConfigFunction(app);
to load the startup values set on the GUI to app.Config (which is a private property). This seems to create an error after Compiler is used. I have set a couple of message-boxes to figure out where the error occurs.
But why is everything working fine befor compilation and after compilation the .exe doesn't work?
  10 件のコメント
Bruno Luong
Bruno Luong 2020 年 10 月 12 日
編集済み: Bruno Luong 2020 年 10 月 12 日
I don't know, I never use Application Compiler app or compiler.package.installer. I use MCC command directly.
You need to make distinction how you open the text file, full path, relative path, etc... and use
isdeployed
function to determine which case the app is runing. I use this function to return the root path of the app, then read the file relative to the app root directory.
function currentDir = getcurrentdir
% currentDir = getcurrentdir
if isdeployed % Stand-alone mode.
[~, result] = system('set PATH');
currentDir = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
else % MATLAB mode.
thisfile = mfilename('fullpath');
currentDir = fileparts(fileparts(thisfile));
end
Of course you have to put the text file at the corresponding places.
Mario Malic
Mario Malic 2020 年 10 月 12 日
Alright, makes some sense. Thank you very much.

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

採用された回答

Dominik Müller
Dominik Müller 2020 年 10 月 12 日
編集済み: Dominik Müller 2020 年 10 月 12 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStandalone Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by