我们如何将JavaFX应用程序与Matlab连接起来

时间:2016-04-03 19:06:33

标签: java matlab javafx

我想使用Java Scene Builder使用JavaFX开发一个应用程序。 但它可以与Matlab连接吗? 我的意思是:我使用Matlab但不是在Matlab上显示结果我想用这个应用程序来显示它 如果是,怎么样?

我需要你的帮助,我正在为我的最终项目研究申请

我等待你的回答 提前谢谢你

1 个答案:

答案 0 :(得分:1)

I have done the same, so yes it is possible.

The link with MatlabControl (Running MATLAB function from Java) is useful, but it was not enough in my case.

In the case if you just want to display some (static) data from the base workspace of Matlab (running some scripts), then it is enough, as you can use MatlabControl class.

In the case of you want some real interaction (you have a domain model in Matlab and want to make changes on the domain model on some user interaction then update the frontend) then this class is not enough (I haven't used it).

To send events from Java to Matlab: http://undocumentedmatlab.com/blog/matlab-callbacks-for-java-events

If you have a bit more complicated application then the structure will look:

  • GUI developed in JavaFX:
    • exposes methods used to update the GUI
    • fires events that can handled by Matlab
  • Matlab GUI Handler:
    • handles JAVA events
    • calls the update functions in Java, based on the state of the Matlab backend
  • Matlab backend

It is also depends on which Matlab version you shall support: In the case that you have to support ML version < R3013a => Matlab is shipped with Java6 JVM. In this case you can provide the JavaFX 2.2 runtime environment (downloading the environment, place near to you code and add javafxrt.jar to the classpath). From R2013a you can go with JavaFX 8. If you are lucky and you have to support just R2015 -> comes with Java8 -> it includes JavaFX.

Hope this helps.

相关问题