Matlab figure to jar file
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi
I want to save a matlab file to a java file such that i can have zooming, rotate options after saving the plot. I know that deploy tool is used for this. When i tried to run the mfile before building it using deploytool I am getting the following error message:
Undefined variable "MWMCR" or class "MWMCR.getCurrent".
Error in ==> javawebfigure at 6 runtime = MWMCR.getCurrent();
Error in ==> webfigure at 50 f = javawebfigure(hnd);
Error in ==> Myfilename at 18 wf = webfigure(handle) ;
I tried to build the file using the tool, but i got error message telling:
unable to build the code....
How to solve this problem? Is there any fix for this? Thanks in advance
Sreenu https://sites.google.com/site/kolukulasivasrinivas/
0 Kommentare
Akzeptierte Antwort
Friedrich
am 2 Dez. 2011
Hi,
where should the java application run at the end? Are you designing a web application or a classical java application?
A webfigure is designed to be displayed on a webpage, example here:
You can't translate a figure directly to a JAVA component. You can create the figure on the ML side, save it as a .fig and write a function which open that fig file. Than you compile that m file which can be executed from JAVA which will than show you the figure.
4 Kommentare
Friedrich
am 3 Dez. 2011
did you put it in with that linebreak in the role? if so, it wont work I think. Please make sure that the <user username="sreenu" password="energy" roles="admin,manager-gui, manager-script"/> is one line without a break.
Weitere Antworten (2)
Kaustubha Govind
am 1 Dez. 2011
I don't have any Java experience, but this is what I see in javawebfigure.m:
import com.mathworks.toolbox.javabuilder.internal.*; % for MWMCR
% get a reference to the current MCR
runtime = MWMCR.getCurrent();
So it looks like MATLAB cannot find the MWMCR class as expected in the com.mathworks.toolbox.javabuilder.internal.* package. I can see javabuilder.jar in $matlabroot/toolbox/javabuilder/jar/$arch - I'm assuming that this is what is required. Is the JAR file present in your MATLAB installation?
2 Kommentare
Kaustubha Govind
am 2 Dez. 2011
Yes, it looks like you do have the correct files for R2010a (my answer mentions the directory structure for R2011b). Strange - I don't have any new ideas, sorry. If possible, you could try re-installing MATLAB to be sure it's not a corrupt install. If that doesn't work, try contacting Tech Support.
KSSV
am 9 Dez. 2011
15 Kommentare
Friedrich
am 16 Dez. 2011
Not sure what causes this. But in normally this error means that java can't find a calls for which it is looking for. In this case a class from the javabuilder.jar. Did you copy the javabuilder.jar in the lib subfolder of your Apache installation? You can check this in the netbeans project under Libraries -> Apache Tomcat -> javabuilder.jar.
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB Compiler SDK finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!