「java写成matlab」java写成员工资代码
本篇文章给大家谈谈java写成matlab,以及java写成员工资代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
怎么从java导入matlab
一、matlab版本必须支持java
在command 模式下面运行deploytool,如果支持该命令即可使用
二、matlab中function的书写
%定义一个函数operation(a,b),求a与b的加减乘除运算,并返回结果
%函数定义function 输出变量列表[s,m,...] 函数名(输入变量列表)sum,sub,mul,div中
function [sum,sub,mul,div] = operation(a,b);
sum = a + b;
sub = a - b;
mul = a * b;
div = a / b;
end
PS:上面function后中括号部分与java中调用该operation的返回值有关系,在java中调用的 Object result[] = XXX.operation(4,a,b); 4表示有4个返回值,分别存放在result[0]到result[4]中。
三、使用matlab编译生成jar
在matlab命令窗口下输入 deploytool,就会弹出一个编译窗口,
然后点击,file,选择new-deployment project,
然后选择matlab builder jave。
name的地方填写工程名,
ocation填写该工程的存储位置。
点击ok。
然后,把m文件添加到工程中,先new一个class,这个class的名字就是你将来在java中需要new的class的名字,也就是matlab中operation所在的class名字然后将你的m文件添加到这个class目录下,然后直接build即可。
四、在java中使用matlab的函数
现在eclipse下面new一个新的java工程,然后将第三部build成功后产生的文件夹下面的distrib目录中的XXX.jar 以及你matlab安装目录下/toolbox/javabuilder/jar/javabuilder.jar加入你的java工程extend lib 中去。
然后你可以清晰的看到XXX.jar中包含的函数和类
五、可能碰到的问题
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.so.7.13, 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.13.
Failed to find the library mclmcrrt710.dll,required by MATLAB Builder JA, on java.library.path
原因是2009a要对应安装mclmcrrt7.10。在MATLAB安装目录下查找:\toolbox\compiler\deploy\win32,找到MCRInstaller.exe 安装,重启Eclipse即可。
求大神matlab用JAVA 写出来!
各个数组不知是整数还是浮点数,若是浮点数,将int 改为double 即可
另外java和C一样,数组序号是从0开始编号的,使用过程得注意
另外下面各数组只是定义,用之前需要初始化
int nc=13;
int sample_amount=3152;
int Add_number=0;
int New_data[][]=new int[1000][13];
int sex_amount[]={3032,1207};
int age_amount[]={611,877,1297,326,41};
int job_amount[]={538,2614};
int education_amount[]={942,1928,270,12};
int marry_amount[]={1125,1854,173};
int experimence_amount[]={2699,453};
int medicine_amount[]={2688,464};
int net_amount[]={380,125,489,305,616,2023,177};
int zanzhu_amount[]={757,2395};
int I=nc-1;
int L=21;
int b[][][]=new int [2][I][L];
int w[][]=new int[21][12];
int H[]={1,2};
int Y=H.length;
int N=1;
int total_m[][][]=new int[N][I][L];
int total_mH[][]=new int[I][L];
int total_curve_mH[][]=new int[I][L];
int total_line_mH[][]=new int[I][L];
int Z[][]=new int[L][1];
int x[][]=new int[][]{{1,25,0,0,80,10,1,0,13,126,210204,0,0},
{1,18,0,6,80,10,0,1,13,2,513431,15,1},
{1,44,1,3,70,20,0,0,2,1,220421,14,0},
{2,43,0,3,70,40,0,0,18,3,513436,0,1},
{1,52,1,2,20,20,1,1,20,9,230122,0,1},
{1,27,0,2,60,10,0,0,0,0,210282,0,0},
{2,16,0,5,70,10,0,1,20,7,210882,1,1},
{1,55,0,0,80,20,0,0,1,0,210522,2,1},
{1,25,1,1,20,20,0,0,0,0,360781,3,1},
{2,21,0,4,60,10,0,1,22,11,411625,1,1},
{2,26,1,3,20,10,0,0,0,0,341621,4,1},
{1,33,0,4,80,10,0,0,0,0,231025,2,1},
{1,31,1,2,60,20,0,0,0,0,230122,3,1},
{1,61,0,4,70,20,1,0,0,0,210204,19,1},
{1,22,0,2,70,10,1,0,18,2,231025,0,1},
{2,59,0,1,80,10,0,0,19,2,220421,1,1},
{1,15,0,3,80,10,0,0,0,0,230122,1,1},
{2,37,1,3,20,40,0,0,18,4,210882,0,0},
{2,31,0,5,80,40,0,1,23,2,210204,5,0},
{1,29,0,7,80,10,1,0,2,2,210282,5,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0}};
请教把java程序转化成matlab程序
主要就是用(0 1 -1)这三个元素生成一个长度为N(任意整数)的序列,在判断些生成的序列中0个数,当0的个数等于3,把这个序列输出来,然后求输出序列的自相关函数和,在判断自相关函数he,如果值除了第一位,其余都为0,那么我们就输出这个序列和它的自相关函数和。
java写成matlab的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java写成员工资代码、java写成matlab的信息别忘了在本站进行查找喔。