Error in creating executable file for MATLAB code

Hi, I made a script that automates some data analysis. I used the MATLAB compiler and made the project. However, when opening the .exe file, an error pops up saying "the functionality is no longer supported under the -nojvm startup".
Is there any other way I can make a project for my MATLAB script? Any suggestions are appreciated..
Thank you!

Risposte (1)

Does it give a hint about what functionality it is referring to?
... Are you using ginput?
Are you compiling as a "Console" application? I would not expect ginput to work as a console application.

10 Commenti

GG
GG il 6 Mar 2017
Modificato: GG il 6 Mar 2017
No? I mean I'm using uigetfile() to open a window so the user can choose the proper xls file.. and I'm also plotting the resulting data using bar().
Are you compiling as a Console (command line) application? If so then I am not sure you can do graphics in that, including not uigetfile(). I suspect you would need to compile as a "Standalone" application.
Caution: remember that compiled applications terminate as soon as they reach the last instruction in the function. If you had some structure like,
[filename, pathname] = uigetfile(....)
data = csvread( fullfile(pathname, filename) );
bar(data)
then (even with a Standalone application) those lines would run but right after it created the plot it would say "Okay, I'm done for the day" and exit the process. If you are creating graphics you need to use a method to ensure that you do not end the program until the user asks to end. uiwait() and waitfor() are good ways to do that. If you happen to use GUIDE then in the main routine it creates there is a commented out uiwait(); if you remove the comment mark then the GUI will not exit until the user closes the figure.
I see. Yes, I did create a standalone application and the same error appeared. So to use waitfor(), I'm not 100% understanding how it works. Is the argument inside of waitfor() the bar graph that I am outputting?
Thanks!
Actually, I tried that with the bar graph as my argument and sadly, that did not work.
If you are not using GUIDE, then figure() explicitly, and waitfor() the figure to prevent exiting early.
With a standalone application chosen and the few things you have mentioned using, I cannot think of any reason you might receive that message about functionality no longer supported.
Which release are you using?
GG
GG il 6 Mar 2017
Modificato: GG il 6 Mar 2017
I am using MATLAB 2016a. And no, I'm not using guide actually. Here is the last bit of my code:
mybargraph = bar(average_stress, 'BarWidth', 0.5);
hold on
set(gca, 'XTick', 1:numel(average_stress), 'XTickLabel', adhesive, 'FontSize', 9);
title('Evaluation')
xlabel('Samples') % x-axis label
ylabel('Average of the Maximum Streses (MPa)') % y-axis label
%Set the bounds of the axis([-x x -y y])
ylim([0 1+max(average_stress)])
hold off
% Save the figure in your current directory
saveas(gcf, 'Regular Eval Data.png');
waitfor(mybargraph);
And I am also assuming it doesn't make a difference whether I select "runtime downloaded from web" or "runtime included in package" right? thank you!
I don't see anything odd looking in that, other than it being uncommon to waitfor() a plot instead of a figure or uicontrol.
Side note: in the code you show, the hold on and hold off are not needed: the calls you do in-between will not trigger a new plot. But the hold calls should not hurt at all, other than a tiny efficiency loss.
That's very odd. Is there another way to make an executable matlab script such that the user doesn't have to open up matlab to run it everytime?
And yes you're right! it's useless, and i forgot to comment it out after I made adjustments. thank you though!

Accedi per commentare.

Categorie

Richiesto:

GG
il 6 Mar 2017

Community Treasure Hunt

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

Start Hunting!

Translated by