如何应用补丁

发布于 2024-08-08 06:03:17 字数 1074 浏览 6 评论 0原文

我有这个补丁代码,是从一篇网络文章(从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

情深已缘浅 2024-08-15 06:03:17

我会下载标准 UNIX patch 工具并使用:

patch -p0 <my_patch.diff

I'd download the standard UNIX patch tool and use:

patch -p0 <my_patch.diff
叹梦 2024-08-15 06:03:17

您需要将该补丁应用于文件 MatlabControl.java。在 Unix 上,您有标准的 patch 程序来执行此操作,但 Windows 上通常不存在该程序。

但看一下补丁文件,它非常小,您可以轻松地手动进行更改。查看补丁文件:左栏中带有-的行必须删除。必须添加带有 + 的行。

因此,您必须查看 MatlabControl.java 并删除此行:

matlab.fevalConsoleOutput(command, args, 0, null);

并添加这些行:

//     matlab.fevalConsoleOutput(command, args, 0, null);
matlab.fevalConsoleOutput(command, args);

换句话说,这是一个非常小且简单的更改,您只需删除方法调用的最后两个参数到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:

matlab.fevalConsoleOutput(command, args, 0, null);

And add these lines:

//     matlab.fevalConsoleOutput(command, args, 0, null);
matlab.fevalConsoleOutput(command, args);

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.

浅唱々樱花落 2024-08-15 06:03:17

如果您使用像 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.

如此安好 2024-08-15 06:03:17

此贴非常小,您可以轻松用手涂抹。

因此,只需打开文件 MatlabControl.java 并更改第 214 行(以 - 开头的行)以适合以 + 开头的行。

之后您的代码应如下所示:

    else{
//                    matlab.fevalConsoleOutput(command, args, 0, null);
        matlab.fevalConsoleOutput(command, args);
    }

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:

    else{
//                    matlab.fevalConsoleOutput(command, args, 0, null);
        matlab.fevalConsoleOutput(command, args);
    }
我纯我任性 2024-08-15 06:03:17

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/

勿挽旧人 2024-08-15 06:03:17

通过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

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文