Java调用Matlab函数笔记
2017-08-08 12:19
351 查看
欢迎使用Markdown编辑器写博客
笔记是记录通过java如何调用matlab函数:1.在命令行中输入deploytool
2.点击上图中标有红框的部分
3.选择javapackage,依次填写name,classname
在package的过程中可能会出现mcc错误的情况,参考如下解决方法:mcc错误
4.编写java类,进行测试
import com.mathworks.toolbox.javabuilder.MWException; import computef.ComputeF; public class matlab2javaTest { public static void main(String args[]) throws MWException { System.out.println( System.getProperty("java.library.path")); ComputeF cl = new ComputeF(); cl.computef(0); } }
第一次运行时,会报如下错误
Exception in thread “main” java.lang.UnsatisfiedLinkError: Failed to find the library mclmcrrt7_14.dll, required by MATLAB Builder JA, on java.library.path.
This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or the current path configuration.
The MCR version that this component is trying to use is: 7.14.
错误原因可能是:path中没有matlab的路径,即找不到mclmcrrt7_14.dll这个文件,添加matlab路径到path中就可以了
5.调用有返回结果的函数
m文件内容:
function [f,c]=computef(key)
调用computerf函数时
Object[] result = null; result = cl.computef(2,0);//第一个参数是返回结果的个数,第二个参数是实际参数
相关文章推荐
- 在Java程序中调用Matlab函数
- java 中调用 Matlab 的函数
- java中调用matlab的函数
- CUBRID学习笔记 38 net调用java的函数过程
- java/eclipse调用matlab功能函数
- java 中调用 Matlab 的函数
- eclipse中java调用matlab函数中的一点点经验
- Java调用Matlab生成的函数,参数为矩阵怎么传递
- java调用c++函数的简单笔记
- OpenCV学习笔记(12)OpenCV调用Matlab函数进行保存视频的尝试
- Java调用Matlab函数以及同时配置多版本JDK的方法
- java中调用Matlab的函数+注意事项
- 在Java程序中调用Matlab函数
- java中调用matlab的BP神经网络工具箱函数
- Java端无需修改正确调用Matlab函数方法
- Java调用MATLAB函数
- [初学笔记] matlab中 函数m文件创立,匿名函数的建立和调用
- 在Java程序中调用Matlab函数
- Java 学习笔记 (10) - Java 函数的递归调用
- [初学笔记]matlab中主函数和次函数的建立和调用(嵌套与不嵌套),全局变量global与子函数的使用