- Undocumented Matlab - https://undocumentedmatlab.com -
Matclipse – Eclipse-Matlab interface
Posted By Yair Altman On February 27, 2013 | 18 Comments
I am extremely pleased to host guest blogger Christopher Albert. Chris and his colleagues created and maintain the enormously-interesting (IMHO) and complex Matclipse project, which connects Java’s popular Eclipse IDE with Matlab.
The open-source matclipse project is an interface between the Java integrated development environment (IDE) Eclipse [1] and Matlab. It was developed at the Institute for Theoretical and Computational Physics [2] (ITP) at Graz University of Technology [3] (TU Graz) by a team that consisted of David Camhy, Winfried Kernbichler, Georg Huhs and Christopher Albert. Matclipse is part of a bigger endeavor, namely, the development of the teaching and learning environment MatlabTutor [4]. It is released under the Eclipse Public License [5] (full text [6]).
The aim of the project is to facilitate the usage of Matlab directly from Eclipse under various operating systems (Linux, Windows, OS X). At the moment, it consists of a workbench, an Matlab editor, a Matlab console including a command window and a viewer for results, a Matlab command history and a Matlab workspace viewer.
The matclipse project is hosted [7] on Google Code. Unfortunately, it does not contain a lot of external documentation, except a somewhat-outdated wiki [8], with installation instructions [9]. A list of open issues is maintained here [10], where you can also report new issues. There is also a newsgroup forum/mailing-list [11] with some activity.
The Matlab workbench uses a tree structure for workspace. One can create Matlab projects there and, of course, all basic features from Eclipse are supported there. Projects can have a Matlab nature and files can be executed directly from the workbench without opening them in the editor.
At the moment, the communication between Java and Matlab is based on the usage of pipes under Linux and OS X and on the usage of DCOM under Windows. In both cases it is necessary to have a local installation of Matlab. An extension to enable communication with a remote Matlab server is planned for the future but various issues (see below) have to resolved for a successful implementation of this feature.
In Linux as well as OS X there is no documented way of access to Matlab, to its memory and to its variables. For that reason, the most reliable way of communication was the usage of pipes. Since in this case, memory in Matlab and memory in Eclipse is strictly separated, any transfer of variables from Matlab to Eclipse needs time and doubles the amount of necessary memory. Therefore, this is not the best of all ways but without the help of MathWorks no other possibility is feasible. Under the operating system Windows, MathWorks provides DCOM as a possibility to control Matlab.
With pipes a remote access to Matlab on a remote Linux server is possible because pipes can be established through a ssh-tunnel. In addition, a remote file system from this server has to be mounted in Eclipse. A good candidate for this seems to be a ssh-based file system. This would enable the storage of programs directly from the editor on the server where Matlab could execute them.
Additional problems arises if graphical output is produced in Matlab or if Matlab tools like the help browser or the profile viewer has to be used. One way to handle this problem is the installation of an X11 server on the client which could display all additional windows from the server on the client through the X11 protocol in case of a correct setting of the display variable. Beside issues of security and speed, technically everything could run as on a local machine but the requirement is a reliable X11server used by Eclipse on the client side.
Another possibility to use a remote server is the conversion of Matlab figures to pictures (e.g. PNG) and to transfer those pictures through the pipe back to the client. The task of eclipse then would be to provide a viewer for this pictures. Of course, any interaction with the figures in a Matlab kind of way (zooming in and out, rotation, etc.) would not be possible. It would also require some overhead to detect what figures are new or have been modified to keep the time for transfer as low as possible. Also bookkeeping for figures has to be established to be able to remove deleted figures from the picture viewer. With the restrictions mentioned above this is possible. A usage of the help browser and profile viewer would not be possible in this case. Ideally, the user could have a choice between both methods.
The Matlab editor is based on a regular expression parser which provides syntax highlighting and checking. A new Xtext-based version had been under development but was not been brought to a usable state due to the limitations of the features and performance of the Xtext framework.
The current features are:
Possible improvements for the future could be:
In contrast to Matlab where input to and output from Matlab is displayed in the same window, matclipse uses a concept with a separate command line for input to Matlab and a results viewer for displaying the output from Matlab nicely separated by the input commands. This concept proved to be practical but has its limitations.
The current features of the command line are the following:
Additional disadvantages and plans for the future are summarized here.
The Matlab history records commands which are executed for further usage. The data are stored in sections with different starting times of a working session. In contrast to Matlab, lines which are used again without any change are not duplicated but moved to the current location. This keeps the list shorter.
In case a couple of lines are executed from the editor with execute selection
, those lines a stored in one entry in the command history and can be recalled at once.
Additional features and fixes are recorded here:
delete old
to the context menu to erase all entries from previous sessions.\n
, one should rather use a space instead for the display and keep it for execution. This is only cosmetics because it just looks ugly.The Matlab workspace viewer enables the user to explore the Matlab variables. In contrast to Matlab, a tree is used for this view where all data types can be displayed. So called container data types like cells and structures are displayed with there size and then a sub-tree is opened which shows the contents in the container. This is possible for the whole depths of those data types. To save time especially when working with pipes, first only the structure of the workspace is shown in the tree together with size information. The detailed information about the content of an array is only transferred from Matlab to Eclipse when this entry is chosen with the mouse or the keyboard.
To avoid unnecessary transfer of data only a limited amount of data from a big array is requested from Matlab. The selection shows relevant information in a compressed form but never shows 100 x 100 array fully. Typically it shows a first block of data from the array accompanied by the last row and the last line to give a good and compact view on the data.
The exchange of information between Matlab and Eclipse is based on a XML description of the workspace generated within Matlab.
Additional features and fixes are recorded here:
(the following is once again in my (Yair’s) own voice):
I would like to direct readers attention to Eigenvector Research (featured as a sidebar ad on this page). Eigenvector provides Matlab-based solutions for multivariate analysis (MVA) with a specific emphasis on chemical applications, i.e. chemometrics. Their products include the PLS_Toolbox [13] for general MVA/chemometrics, and MIA_Toolbox [14] for Multivariate Image Analysis. They also provide training [15] and consulting [16] services.
If you work with applications that produce large amounts of multivariate data, you may well find their products and services useful.
Categories: Guest bloggers, Java
Article printed from Undocumented Matlab: https://undocumentedmatlab.com
URL to article: https://undocumentedmatlab.com/articles/matclipse-eclipse-matlab-interface
URLs in this post:
[1] Eclipse: http://www.eclipse.org
[2] Institute for Theoretical and Computational Physics: http://itp.tugraz.at/
[3] Graz University of Technology: http://www.tugraz.at
[4] MatlabTutor: http://itp.tu-graz.ac.at/wiki/index.php/MLTutor_Konzept
[5] Eclipse Public License: http://en.wikipedia.org/wiki/Eclipse_Public_License
[6] full text: http://www.eclipse.org/legal/epl-v10.html
[7] hosted: http://code.google.com/a/eclipselabs.org/p/matclipse/
[8] wiki: http://code.google.com/a/eclipselabs.org/p/matclipse/w/list
[9] installation instructions: http://code.google.com/a/eclipselabs.org/p/matclipse/wiki/Installation
[10] here: http://code.google.com/a/eclipselabs.org/p/matclipse/issues/list
[11] newsgroup forum/mailing-list: http://groups.google.com/group/matclipse
[12] Image: http://undocumentedmatlab.com/images/matclipse_workbench.gif
[13] PLS_Toolbox: http://www.eigenvector.com/software/pls_toolbox.htm?undoc
[14] MIA_Toolbox: http://www.eigenvector.com/software/mia_toolbox.htm?undoc
[15] training: http://www.eigenvector.com/training.htm?undoc
[16] consulting: http://www.eigenvector.com/consult.html?undoc
[17] JMI – Java-to-Matlab Interface : https://undocumentedmatlab.com/articles/jmi-java-to-matlab-interface
[18] Matlab-Java interface using a static control : https://undocumentedmatlab.com/articles/matlab-java-interface-using-static-control
[19] Matlab-Latex interface : https://undocumentedmatlab.com/articles/matlab-latex-interface
[20] HG's undocumented parameters interface : https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface
[21] JGit-Matlab integration : https://undocumentedmatlab.com/articles/jgit-matlab-integration
[22] JGraph in Matlab figures : https://undocumentedmatlab.com/articles/jgraph-in-matlab-figures
[23] : https://undocumentedmatlab.com/matlab-java-book/
[24] : http://www.mathworks.com/products/javabuilder/
[25] : https://undocumentedmatlab.com/blog/jmi-java-to-matlab-interface/
[26] : https://undocumentedmatlab.com/blog/jmi-wrapper-local-matlabcontrol-part-1/
[27] : https://undocumentedmatlab.com/blog/jmi-wrapper-remote-matlabcontrol/
[28] : http://www.mathworks.com/help/matlab/using-java-libraries-in-matlab.html
[29] : http://eclipse.org
[30] : https://en.wikipedia.org/wiki/Eclipse_(software)
Click here to print.
Copyright © Yair Altman - Undocumented Matlab. All rights reserved.
18 Comments To "Matclipse – Eclipse-Matlab interface"
#1 Comment By Bluesmaster On March 2, 2013 @ 05:36
No doubt, that this is a great work.
I am asking myself, whether it is possible to provide the great workspace-tree-viewer for use in matlab itself
I know there is “exploreStruct” at the FEX but i cant get it running and (I think ) it doesnt support custom classes
#2 Comment By kushal On May 20, 2013 @ 01:42
Hello Sir,
how to call a ‘function’ defined in .m file from a java program?
E.g.:
Say I have a sample_class ‘sample.java’ in this sample.java,
and
a function is defined in matlab_sample.m
I wish to pass some parmeters as arguments to this matlab_sample.m function from java program and wish to access return values in java program back.
pls guide on above issue.
thank you.
#3 Comment By Yair Altman On May 20, 2013 @ 02:04
@Kushal – the various ways to do this are listed in my [23]. Basically, you could use MathWorks’ [24], or [25] (see related MatlabControl package – [26], [27]), or JNI, or COM, or DDE, or TCP/IP, or a few other technologies.
#4 Comment By kanmani On October 25, 2013 @ 03:56
i had finished my project named sentence clustering using in java
how to convert the java code written in eclipse to matlab
i jut want to run my java project in matlab
pls help me
#5 Comment By Yair Altman On October 25, 2013 @ 04:02
You can run your Java code directly from Matlab: [28]
#6 Comment By Chandrakanth On October 28, 2013 @ 23:34
Has Eclipse discussed here got anything to do with eclipseclp ? eclipseclp dot org
#7 Comment By Yair Altman On October 29, 2013 @ 03:51
@Chandrakanth – no. It is the open-source Eclipse IDE at [29] ( [30])
#8 Comment By kanmani On November 9, 2013 @ 09:24
how to run java project developed in eclipse in “MATCLIPSE”
#9 Comment By Brandon Gallas On November 16, 2013 @ 08:58
I have a java gui that was developed by a young cs graduate that has since moved on (gov funding is tight with lots of uncertainties, darn it). As I am dealing with validating the code and ironing out bugs, a colleague has shown me all the excellent java programming tools. I am especially interested in the mapping of program dependencies and data flow (like code pro tools and flow chart generator). Since I was not the developer, I need help finding my way around the code.
I also have a matlab gui that was developed by another young scientist and have taken over the programming duties on that as well. Yes funding is tight.
I would like to know if the programs that map program dependencies and data flow can analyze the matlab gui. Thanks for your time.
#10 Comment By Yair Altman On November 16, 2013 @ 09:33
@Brandon – I’m not sure what you need and how it is related to this article or this blog in general…
#11 Comment By Jeridiah Welti On December 6, 2013 @ 07:52
Brandon, you appear to be off the original topic, but look for m2html. It’s a plugin for Matlab. It will generate a dot file for the Matlab program. It does a good job of plotting the callers and you can visually see the functional layout of the program.
#12 Comment By mailord On January 22, 2014 @ 00:37
Is there any opportunity get matlab features running like (1) code completion or (2) highlight of a marked variable in the whole m-file or (3) the use of sections with ‘%%’?
#13 Comment By Carlos On April 17, 2014 @ 09:38
I would also love those features in Matclipse…At least to be able to comment lines with keyboard shortcuts for now.
Where can we find the latest version of Matclipse?
#14 Comment By Luis On September 25, 2014 @ 14:40
Is there anyway to convert from .m to .jar without using MATLAB Builder Ja?, I really need to know, i have been trying for days.
Thank you!
#15 Comment By Yair Altman On September 27, 2014 @ 09:45
@Luis – yes: you can manually create the Java code yourself based on the m-code. There is no other way.
#16 Comment By Stoyan Atanasov On March 7, 2015 @ 04:06
Hi,
I’m really interested in the Xtext model of the Matlab language for a IDE for octave. I have started to create one and it will be nice to check with yours.
Regards
#17 Comment By Stoyan Atanasov On March 7, 2015 @ 04:10
Also it can be used to generate Java code easily or use the JVM integration with Xbase.
#18 Comment By Komal On March 8, 2016 @ 09:16
Hello Sir
we have completed feature extraction of fingerprint in matlab and want to use the extraction results in eclipse so can you tell how to take the values from matlab and use it in eclipse.