0

I would like to develop an application with JavaFX using the Java Scene Builder. But is it possible to connect it with Matlab? I mean : I work with Matlab but instead of displaying the results on Matlab I want to show it with this application If yes, how ?

Please I need your help, I am making an application for my final project study

I await your answers thank you in advance

ridoibm75
  • 27
  • 2
  • 10

1 Answers1

2

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.

Community
  • 1
  • 1
DVarga
  • 21,311
  • 6
  • 55
  • 60