Create a GUI in Java and calling Matlab scripts from Java
15 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Titus Edelhofer
2011 年 7 月 26 日
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 件のコメント
その他の回答 (1 件)
Yair Altman
2011 年 8 月 7 日
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 件のコメント
Ned Twigg
2015 年 10 月 20 日
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.
参考
カテゴリ
Help Center および File Exchange で Text Data Preparation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!