How can I open a file in a compiled application?

조회 수: 10 (최근 30일)
Tom Tomlinson
Tom Tomlinson 2019년 7월 8일
답변: Vincent Prevosto 2020년 1월 31일
I have a trial license for the Matlab compiler. I would like to build an application to display .fig files. I have created an application that opens a Figure window. However, when I try to open a .fig file, I get an error message "Warning: The Open function cannot be used in compiled applications". Is this a limitation of the trial license, or does it apply to all compiled applications in general?
  댓글 수: 1
Jan
Jan 2019년 7월 9일
"when I try to open a .fig file" - please post the corresponding code.

댓글을 달려면 로그인하십시오.

답변 (2개)

Vincent Prevosto
Vincent Prevosto 2020년 1월 31일
Just to confirm, Jan's suggestion is correct. To compile a standalone Figure viewer:
  • Create a file (e.g., FigViewer.m) with the code below:
[fileName,dirPath] = uigetfile('*.fig','Select a figure (.fig) file');
openfig(fullfile(dirPath,fileName));
  • Then compile it in the main command window with the compiler:
mcc -m -v FigViewer.m
% or, version without prompt
mcc -e -v FigViewer.m

Jan
Jan 2019년 7월 9일
The error message is clear in this point: You cannot use open in compiled applications. This is not a limitation by the trial version.
What about openfig?
  댓글 수: 4
Jan
Jan 2019년 7월 11일
편집: Jan 2019년 7월 11일
[MOVED from section for answers] Tom Tomlinson wrote
Sorry; I guess I wasn't clear. There is no code. It's a figure window. The "Open File" button in the figure window, when clicked, causes a "File open" dialog to pop up, but when a file is selected and OK is clicked, nothing happens. In the terminal window from which the figure window compiled application was launched, I see the error message, "Compiled applications cannot use the File Open function."
It is clear that I'm barking up the wrong tree here, and I don't want to waste any more of anyone's time. Thanks for trying.
Jan
Jan 2019년 7월 11일
@Tom: Please do not post comments in the section for answers. Use the section for comments instead. Thanks.
"I would like to build an application to display .fig files" - this is possible and not hard to implement.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by