Results 1 to 7 of 7
- 10-17-2009, 08:29 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 1
- Rep Power
- 0
How to apply a patch (Call Matlab from Java)
I want to call matlab functions from java. I found an interresting article which says how to do it.
My problem is, I think I need to apply a patch to get it working and I hava the code, but i have no idea how to apply it.
Any help is hightly appreciated. Thank You.
here is the patch code
Index: MatlabControl.java
================================================== =================
RCS file: /cvsroot/tinyos/tinyos-1.x/tools/java/net/tinyos/matlab/MatlabControl.java,v
retrieving revision 1.3
diff -u -r1.3 MatlabControl.java
--- MatlabControl.java 31 Mar 2004 18:43:50 -0000 1.3
+++ MatlabControl.java 16 Aug 2004 20:36:51 -0000
@@ -214,7 +214,8 @@
matlab.evalConsoleOutput(command);
}
else{
- matlab.fevalConsoleOutput(command, args, 0, null);
+ // matlab.fevalConsoleOutput(command, args, 0, null);
+ matlab.fevalConsoleOutput(command, args);
}
} catch (Exception e) {
System.out.println(e.toString());
- 10-21-2009, 04:34 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
If you're running a un*x box you can run 'patch' to do the job (also see "man patch"). The patch program takes a diff file (the thing you dispayed) and a source file and applies the patches listed in the diff file to the source file; if you don't have patch available you can always apply the patches manually (just edit the source file). - means delete the line, + means add the line. Also google for "unix apply patch" for the exact syntax of diff files.
kind regards,
Jos
- 10-21-2009, 05:33 PM #3
in unix there is a patch command, likely if you are in the top level folder
Eclipse IDE supports applying a .patch file to a project, but this requires you to have the sources set up in a workspace, which can be a pain if you don't already use eclipse.Java Code:patch -i the_patch_file.patch
in this case, you could just open up this MatlabControl.java, go to line 214, and comment out
matlab.fevalConsoleOutput(command, args, 0, null)
and adding after it
matlab.fevalConsoleOutput(command, args);
You would then need to rebuild these java sources, such as using what ever instructions were given with this package. Most projects now use ant or maven tools for this. hopefully there is instructions for doing this.
- 04-19-2010, 11:50 PM #4
Member
- Join Date
- Apr 2010
- Posts
- 1
- Rep Power
- 0
Calling Matlab from Java
http://jamal.sourceforge.net/ It is decently documented, has some examples and does really good job if you need call Matlab from Java.
- 04-20-2010, 05:29 AM #5
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
I've written applications that interact with matlab via Runtime.exec. Matlab has a terminal mode that facilitates piping information back and forth via stdin/stdout. This is handy if you need to run a filter design tool or something like that and want to interract with the results.
Matlab also has direct Java support built-in, so you can instantiate a java object from Matlab and interract that way too.
- 07-09-2011, 02:32 AM #6
Member
- Join Date
- Jul 2011
- Posts
- 1
- Rep Power
- 0
Java API to call MATLAB from Java
matlabcontrol is a Java API which makes it very easy to call MATLAB from Java. It can do everything the MatlabControl class can and do more, including controlling MATLAB from a Java application running outside of MATLAB. Using the API is as if you were interacting with MATLAB's Command Window, and you can retrieve the results as Java objects. To get started, take a look at the walkthrough.
- 07-09-2011, 02:55 AM #7
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
This thread is pretty old(1 year since last post, 2 years since original post), please don't resurrect old threads.
Similar Threads
-
run a matlab script from java
By npoorni in forum Advanced JavaReplies: 5Last Post: 02-11-2010, 03:32 PM -
Help, Integrate a Java with Matlab
By toby in forum Advanced JavaReplies: 2Last Post: 08-07-2008, 07:08 AM -
java.io.IOException: CreateProcess: matlab error=2
By Jack in forum Advanced JavaReplies: 3Last Post: 04-10-2008, 09:01 AM -
Need help in releasing a patch to Java application
By venusunil in forum Advanced JavaReplies: 1Last Post: 10-31-2007, 09:35 PM -
ERROR: Java(TM) failes to apply changes to your system
By coco in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks