如何应用补丁
我有这个补丁代码,是从一篇网络文章(从 Java 调用 Matlab)中下载的。 http://www.cs.virginia.edu/~whitehouse/matlab/ JavaMatlab.html
但我不知道如何在我运行windowsXp的计算机上应用它。 我想做的是从 java 调用 Matlab 脚本文件。我已经找到了必要的源代码和所有东西,但这位母亲却迟迟没有回来。 非常感谢任何帮助。谢谢。
这是补丁代码。
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());
I have this patch code which i downloaded from a web article (Calling Matlab from Java).
http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html
But I donot know how to apply it in my windowsXp running computer.
What I'm trying to do is call Matlab script file from java. I have found the necessary source codes and every thing but this mater is holding be back.
Any help is highly appreciated. Thank you.
Here's 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());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我会下载标准 UNIX
patch
工具并使用:I'd download the standard UNIX
patch
tool and use:您需要将该补丁应用于文件 MatlabControl.java。在 Unix 上,您有标准的
patch
程序来执行此操作,但 Windows 上通常不存在该程序。但看一下补丁文件,它非常小,您可以轻松地手动进行更改。查看补丁文件:左栏中带有
-
的行必须删除。必须添加带有+
的行。因此,您必须查看
MatlabControl.java
并删除此行:并添加这些行:
换句话说,这是一个非常小且简单的更改,您只需删除方法调用的最后两个参数到
fevalConsoleOutput()
。如果您想在 Windows 上使用
patch
命令(以及许多其他 Unix 实用程序),您可以下载并安装You need to apply that patch to the file MatlabControl.java. On Unix, you have the standard
patch
program to do that, but that ofcourse isn't normally present on Windows.But looking at the patch file, it's very small and you could easily do the change by hand. Look at the patch file: The lines with a
-
in the left column must be removed. The lines with a+
must be added.So you must look in
MatlabControl.java
and remove this line:And add these lines:
In other words, it's a very small and simple change, you just have to remove the last two arguments to the method call to
fevalConsoleOutput()
.If you want the
patch
command (and lots of other Unix utilities) on Windows, you could download and install Cygwin.如果您使用像 Eclipse 这样的开发工具,您可以轻松应用它,因为它是上下文菜单中的一个选项(右键单击)转到团队 - >应用补丁。它应该有效。
If you use dev tools like Eclipse you can easily apply it as it is an option in the contextual menu (right click) go to Team - > Apply Patch. It should work.
此贴非常小,您可以轻松用手涂抹。
因此,只需打开文件
MatlabControl.java
并更改第 214 行(以-
开头的行)以适合以+
开头的行。之后您的代码应如下所示:
This patch is so small, you can easily apply it by hand.
So simply open the file
MatlabControl.java
and change line 214 (the one prepended with-
) to fit the lines prepended with+
.After that your code should look like:
JMI(Java-to-Matlab Interface)的 Matlab 类及其 fevalConsoleOutput 方法解释如下: http://UndocumentedMatlab.com/blog/jmi-java-to-matlab-interface/
JMI (Java-to-Matlab Interface)'s Matlab class and its fevalConsoleOutput method are explained here: http://UndocumentedMatlab.com/blog/jmi-java-to-matlab-interface/
通过Tortoise SVN,我们可以按照以下方式打补丁。单击“应用补丁”并浏览补丁文件。
乌龟SVN
By Tortoise SVN, we can apply patch by following the below way. Click on Apply patch and browse the patch file.
Tortoise SVN