no figure when calling a Matlab function from Java(Eclipse)

2 views (last 30 days)
I am trying to do math compution in Java using a matlab function. ----------------------------------------------------------- Matlab Code: function out=plotsin(first,step,last) in=first:step:last; out=sin(in); figure('Name','Math Plot -Sin Function','NumberTitle','off'); plot(in,out,'b-'); axis([first last -1.5 1.5]); grid on; title('sin curve'); end ---------------------------------------------------------
I have compiled *.m to matlabplot.jar using deploytool in matlab IDE and added matlabplot.jar and javabuilder.jar to project in Ecilpse, as image(1)
In eclipse, java code as following: --------------------------------------------------- package testMath; import matlabplot.*;
public class MatlabPlotTest { public static void main(String[] args){ try{ MathPlot func=new MathPlot(); func.plotsin(1, 0.0f, 0.1f, 10*Math.PI); //func.plotcos(1, 0.0f, 0.1f, 10*Math.PI); }catch (Exception e){ e.printStackTrace(); } }
} ------------------------------------------------------
But there is no curve in figure window,the figure window is blank. as image(2)
could anybody tell me why?

Answers (0)

Categories

Find more on Startup and Shutdown 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!