Open .Fig file with compiled exe

9 ビュー (過去 30 日間)
Stefano Cucchi
Stefano Cucchi 2022 年 2 月 26 日
コメント済み: Walter Roberson 2023 年 6 月 6 日
Hello,
i'm having a problem opening .fig files using a executable file compiled with Matlab Compiler. The strange fact is that if i use the normal script (in Matlab) the .fig files are opened properly, but not using the executable.
Here's the code:
%get the list of files in the current directory
a=dir;
a(1:2)=[];
%create list of names with only .fig files
j=1;
for i=1:length(a)
list_fig(j)=string(a(i).name);
if endsWith(list_fig(j),'.fig')
j=j+1;
else
list_fig(j)=[];
j=j;
end
end
%choose the .fig files i want to open
[indfig,tf] = listdlg('ListString',list_fig,'SelectionMode','multiple','Name','Seleziona figure','ListSize',[250,150]);
for i=1:length(indfig)
openfig(list_fig(indfig(i)));
end
If i use OpenFile.exe i get this result:
If i use OpenFig.m i get this (correct) result:
As you can see, in the second case i get more useful "tools" (Edit Plot is the one i really need).
Why? How can i solve this problem?
Thank you in advance

採用された回答

Walter Roberson
Walter Roberson 2022 年 2 月 26 日
The plot editor cannot be used from standalone execution
If the tools could be used then users would be able to set arbitrary code as callback functions, and so would gain access to functions not compiled into the executable, which would be a license violation.
Question: why are you not using
a=dir('*.fig');
to avoid the loop testing the file name?
And how do you know which directory to cd to in a portable way? See uigetfile() and ctfroot()
  2 件のコメント
Stefano Cucchi
Stefano Cucchi 2022 年 2 月 26 日
Thanks for your answers and your advices!
Walter Roberson
Walter Roberson 2023 年 6 月 6 日
I recommend that you have your lawyer assess the Mathworks license terms before relying on your personal interpretation.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by