Matlab和Java集成 [英] Matlab and Java integration

查看:592
本文介绍了Matlab和Java集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MATLAB中完成了图像处理,并用Java构建了我的GUI。我想将MATLAB集成到Java中。我想将MATLAB Builder用于此目的。我也想用神经网络进行分类。还有一些excel文件。是否有可能将此代码集成到Java中?

I have done image processing in MATLAB and build my GUI in Java. I want to integrate MATLAB into Java. I want to use MATLAB Builder for this purpose. I want also to use neural network for classification. There are some excel files also. Is it possible that this code will be integrated in Java?

我的另一个问题是我想用MATLAB BuilderJA来了解它是如何工作的。当我输入 java -version 命令时,它给了我这个错误。

My other question is that I want used MATLAB BuilderJA to know how it works. When I type java -version command, it gave me this error.

??? Attempt to execute SCRIPT java as a function:
C:\Program Files\MATLAB\R2009b\toolbox\matlab\general\java.m
 C:\Program Files\Java\jdk1.6.0_21

当我使用build命令时,它给了我这个错误。

When I use build command it gave me this error.

'javac' is not recognized as an internal or external command,
operable program or batch file.
Error: An error occurred while shelling out to javac (error code = 1).
Unable to build executable.

我安装了JDK。路径为 C:\Program Files \ Java @ \\ _ddk1.6.0_21 。我正在使用 R2009b 版本

I have JDK installed. The path is C:\Program Files\Java\jdk1.6.0_21. I am using R2009b version

我想用Java运行我的代码,但我不知道如何修复这个错误。任何人都可以告诉我如何解决此错误吗?

I want to run my code in Java, but I do not know how to fix this error. Can any one tell me how to resolve this error?

推荐答案

键入<$ c $时出现的第一条错误消息c> java -version 有点误导;而不是

java -version

你需要说

!java -version

因为您要调用外部程序而不是MATLAB脚本或函数。正如Amro的评论中所述,只有包含java.exe的目录位于您的路径上时才会起作用。请参阅MATLAB帮助中的运行外部程序更多信息。

since you want to call an external program and not a MATLAB script or function. As stated in the comments by Amro this will only work if the directory containing java.exe is on your path. See Running External Programs in the MATLAB help for more info.

您收到的错误消息来自


  • 碰巧有一个文件java.m而MATLAB认为你试图调用这个文件

  • 该文件只包含注释,因为 java 实际上是MATLAB中的一种关键字,请参阅 doc java

  • MATLAB意识到您没有以正确的形式使用关键字(可以调用 java.something 来创建对象类某事),因为你提供了一个参数

  • MATLAB最终以一种奇怪的方式告诉你 java 不接受参数(即使java.m不包含脚本,只包含其文档)

  • there happens to be a file java.m and MATLAB thinks you are trying to call this file
  • that file only contains comments, since java is actually a sort of keyword in MATLAB, see doc java.
  • MATLAB realizes that you are not using the keyword in its correct form (which would be to call java.something to create an object of class something) since you give a parameter
  • MATLAB ends up telling you in a strange way that java doesn't accept parameters (even though java.m does not contain the script, only its documentation)

请注意,如果您不想将包含java.exe和javac.exe的目录添加到路径中,您还可以尝试使用其完整路径名称来调用它们:

Note that if you don't want to add the directory containing java.exe and javac.exe to the path, you could also try calling them with their full path name:

!C:\Program Files\Java\jdk1.6.0_21\blablabla\bin\javac.exe

这篇关于Matlab和Java集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆