How can I open a file in a compiled application?

10 views (last 30 days)
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 Comment
Jan
Jan on 9 Jul 2019
"when I try to open a .fig file" - please post the corresponding code.

Sign in to comment.

Answers (2)

Vincent Prevosto
Vincent Prevosto on 31 Jan 2020
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 on 9 Jul 2019
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 Comments
Jan
Jan on 11 Jul 2019
Edited: Jan on 11 Jul 2019
[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 on 11 Jul 2019
@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.

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!