How to import a plot from Matlab to Java ?

2 ビュー (過去 30 日間)
Nouran Adel
Nouran Adel 2019 年 7 月 29 日
回答済み: Bhargavi Maganuru 2019 年 8 月 2 日
Hello , I'm writing a Java code to make a certain application and and now I want to draw a plot using an array of x-axis values and another array of y-axis values as an input from the user then after plotting I will need to extract some data from the plot ; so I thought Matlab would be my best choice . I know how to open a Matlab session from Java and I know how to execute Matlab commands from Java using evalAsync and I can import variables from Matlab to Java using getVariable but how can I import a plot ??
I tried this code :
MatlabEngine eng = MatlabEngine.startMatlab();
eng.evalAsync("x=[2,3,8]; y=[15,8,30]; plot(x,y)");
when I run a window opens with the plot but just for some seconds then it closes by itself and after some time the program terminates , how can I make it last for some time or prevent it from closing ? or Is there a way to directly import the plot ?
Thanks

回答 (1 件)

Bhargavi Maganuru
Bhargavi Maganuru 2019 年 8 月 2 日
You can try using Java class(plotter) .You can refer to the documentation link for more information: https://www.mathworks.com/help/compiler_sdk/java/plot-example.html

カテゴリ

Help Center および File ExchangeCall MATLAB from Java についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by