Create a GUI in Java and calling Matlab scripts from Java
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nathan
am 26 Jul. 2011
Kommentiert: Ned Twigg
am 20 Okt. 2015
Hey all,
I currrently have a functioning Matlab script (and a few other scripts that help with it) that uses avifile, addframe and implay to create and then play back a movie of an animation I have made. The animation loops through .mat files that have
I currently have a 2D animation where I use the image function to create a 4x11 set of small boxes, each representing an individual sensor in a larger scheme of sensors implanted in the ground. In the animation, the color of each box corresponds to the scalar value of the acceleration reading for each sensor. I created the animation by using creating an aviobj using the avifile() function, then using a loop to update the color values and the object with a new figure representing the data using addframe(). I save the AVI file, then I play it back with implay() so I can have the play/pause features.
Now, I was thinking of writing some Java code and making a Java program with a GUI that in some user input for a filename/time period for the data to be used (or some user input like that) and then call the appropriate Matlab scripts from Java. How might I make this happen? I read about the matlabcontrol API and was considering that but am looking for other potential ways to handle this. A potential alternative would be to have the animation carried out from Java? Anything helps, thanks in advance
NathanF
0 Kommentare
Akzeptierte Antwort
Titus Edelhofer
am 26 Jul. 2011
Hi,
there are several points here to clarify: first of all, why not write the GUI in MATLAB? From your description it seems, that it will not be a hyper-fancy-crowded-with-lots-of-complicated-controls type of GUI, which will be easy to implement in MATLAB.
If it "must" be Java, then (from an implementation point of view) using MATLAB Builder JA would be the simplest approach. Other approaches would be to start MATLAB with the "-r" parameter as a batch processing. Deciding between these options depend on whether other people would like to use the GUI+Computation, and if they have MATLAB or not.
Titus
0 Kommentare
Weitere Antworten (1)
Yair Altman
am 7 Aug. 2011
You can use the MatlabControl Java package to call Matlab directly from Java without needing the Matlab Builder JA toolbox: http://UndocumentedMatlab.com/blog/jmi-wrapper-remote-matlabcontrol/
1 Kommentar
Ned Twigg
am 20 Okt. 2015
matlabcontrol is fantastic, but it hasn't been updated in a couple years.
I've created a binary-compatible fork on GitHub which is actively maintained called MatConsoleCtl.
- available on Maven Central as com.diffplug.matsim:matconsolectl
- a way to connect to an existing MATLAB session by copy-pasting a string of text to the MATLAB console
- more descriptive error messages in exceptions
- compatibility with OSGi classloaders
- fixed all compiler warnings
- fixed several tricky bugs which were found by FindBugs
I'm happy to accept any GitHub Issues or Pull-Requests, and I'll be keeping it up-to-date and tested.
Siehe auch
Kategorien
Mehr zu Text Data Preparation 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!