當前位置:首頁 » 編程軟體 » matlabjava混合編程

matlabjava混合編程

發布時間: 2023-02-28 22:45:36

㈠ matlab與java混合編程有什麼作用

Java和matlab混合編程

如果用Matlab和java混合編程開發Windows的應用程序則可以實現優勢互補,縮短開發時間,降低程序設計的復雜度。同時程序可以脫離Matlab環境獨立運行,在工程計算和教學實踐中都具有實際意義。
1.使用java調用Maltab函數的基本方法是:通過Java Builder實現Java調用Matlab。在Java環境中直接調用Matlab所生成的Jar包。

下面以在Java中產生任意維數的魔方矩陣,計算任意矩陣的特徵向量和特徵值,對兩組數據進
行擬合並繪制擬合曲線三個實例來說明通過Java
Builder實現Java調用Matlab的過程。傳統的純Java編程實現上述實例非常復雜,甚至很難完成。這一問題在Matlab中只需要調用幾個
函數即可完成。

1.1、將Matlab函數包裝成Java類

首先在Matlab中編寫三個M文件:

Eig.m

function [v,d]=Eig(input)

format long

[v,d]=eig(input);

End

Magic.m

function f =Magic( input )

f=magic(input);

end

Plot.m

function Plot(x,y )

p=polyfit(x,y,3);

t=min(x):max(x)/100:max(x);

s=polyval(p,t);

plot(x,y,'*',t,s);

title('數據擬合結果');

xlabel('x');

ylabel('y');

end

其次,在Matlab中新建一個Deployment
Project,名稱為MyProject.prj,類型為Java
package。在Project中新建三個Class,分別為GetEig,GetMagic,PolyFit。將
Eig.m,Magic.m,plot.m分別添加到上述Class中。之後點擊Builder the project,等待編譯成功即可。

1.2、在Java中調用Matlab函數

新建一個Java類JavaMatlab,並引入相關的包。

import com.mathworks.toolbox.javabuilder.*;//引入Matlab相關包

import MyProject.*;//引入建立的包及類

調用時Java與Matlab之間的參數傳遞需要通過MWNumericArray完成。具體的調用代碼如下:

package org.genius.ExpandJava;

import MyProject.*;

import com.mathworks.toolbox.javabuilder.*;

public class JavaMatlab {

public static void main(String[] args) {

MWNumericArray a = null; // 用於保存矩陣

MWNumericArray ax = null; // 用於保存矩陣

MWNumericArray ay = null; // 用於保存矩陣

Object[] result = null; // 用於保存計算結果

GetEig getEig = null;

GetMagic getMagic=null;

PolyFit polyFit=null;

int r = 4; // 魔方矩陣維數

int array[][]={{50,-20,0},{-20,80,60},{0,60,-70}};

double x[]={0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1};

double y[]={-0.447,1.978,3.28,6.16,7.08,7.34,7.66,9.56,9.48,9.3,11.2};

try {

//產生魔方矩陣並列印

a = new MWNumericArray(r, MWClassID.DOUBLE);

getMagic = new GetMagic();

result = getMagic.Magic(1,a);

System.out.println("產生的四維魔方矩陣:");

System.out.println(result[0]);

MWArray.disposeArray(result);

//計算所給矩陣的特徵向量和特徵值並列印結果

a = new MWNumericArray(array, MWClassID.DOUBLE);

getEig = new GetEig();

result = getEig.Eig(2, a);

System.out.println("原始矩陣:");

System.out.println(a.toString());

System.out.println("得到的特徵向量:");

System.out.println(result[0]);

System.out.println("得到的特徵值:");

System.out.println(result[1]);

MWArray.disposeArray(result);

ax = new MWNumericArray(x, MWClassID.DOUBLE);

ay = new MWNumericArray(y, MWClassID.DOUBLE);

polyFit = new PolyFit();

result=polyFit.Plot(ax,ay);

polyFit.waitForFigures();

} catch (Exception e) {

System.out.println("Exception: " + e.toString());

}

finally {

// 釋放本地資源

MWArray.disposeArray(a);

MWArray.disposeArray(ax);

MWArray.disposeArray(ay);

MWArray.disposeArray(result);

getEig.dispose();

getMagic.dispose();

polyFit.dispose();

}

}

}

㈡ matlab與java混合編程報錯

: 這個是字元串操作越界了,檢查一下代碼,是不是有substring這樣的操作,應該是這樣引起的

㈢ matlab java 混合編程,報的錯Error using NaN Trailing string input must be 'single' or 'double'

參數傳遞錯誤,導致原來是傳遞正確的數字類型、變成傳遞空/null字元串了

㈣ MATLAB怎麼學呢

一,MATLAB功能非常全面,也非常強大,
主要用於科學計算,它的計算基於矩陣來實現,可用於以下方面:
1,數值計算(好多問題沒有解析解);
2,符號計算(呵呵,很強悍,做高數題方便了,不過在這方面MATLAB還不
是相當強,它的符號計算庫借用了Maple的);
3,數據的分析,處理及可視化(數據繪圖很方便);
4,圖形圖像處理,信號分析處理等等;
5,Simulink建模模擬,這是MATLAB非常有特色也是非常強大的功能,也使得其應用不僅僅局限於一般的科學計算。
二,MATLAB的軟體應用:
MATLAB是用C語言開發的,支持編程,而且其語法跟C語言很相似,樓主想必已經學過C語言,再學習MATLAB會很輕松。
MATLAB支持與C語言,Fortran語言,Java語言的混合編程,同時支持與word,excel的混合使用,擴展性強。
三,MATLAB的學習:
學習它首先要有比較好的教材,初級階段就用比較簡單的教材,清華的,北航的,都可以。
高級階段要用比較厚重,全面的教材,推薦一本鄙人正在使用的教材,人們郵電出版社出版,求是科技編著的《MATLAB
7.0
從入門到精通》,還有一本國內翻譯的由美國人寫的教材,很厚,很全(樓主自己在網上搜一下,我見同系的同學拿過,還是相當不錯的)。
另外,學習MATLAB跟學習其他語言一樣,要多上機,多練習,熟能生巧嘛。最後祝樓主學習愉快。
以上系個人總結,有啥不妥之處,還請見諒啊(看在我碼這么多字的份上,也該獎勵一下吧,呵呵)。

㈤ 求C語言教程和JAVA教程

資料內容所涉及方面:
C/C++/VC++的基礎教程、通訊、協議分析、游戲開發、圖像處理、管理系統、多媒體、加密與解密、控制項ACTIVEX、開發CGI、標准程式庫、技術內幕、Windows核心編程、對象模型、人工智慧、軟體工程、數據結構、WindowsAPI、Visual Basic 、Directx、網路開發、資料庫開發、ADO、神經網路、DLL和內存管理、OLE&DDE、操作系統、埠、數值演算法、等等技術或相關開發資料。
《C語言專區》
C語言實例教程 1.72
http://download.chinaitlab.com/soft/8658.htm

經典編程900例(C語言)
http://download.chinaitlab.com/soft/7972.htm

C語言實例教程
http://download.chinaitlab.com/soft/6530.htm

C語言圖象處理方法
http://download.chinaitlab.com/soft/6514.htm

C語言編程實例
http://download.chinaitlab.com/soft/6103.htm

C語言書打包下載
http://download.chinaitlab.com/soft/6041.htm

集成學習環境(C語言)
http://download.chinaitlab.com/soft/5764.htm

C語言聖經 1.0
http://download.chinaitlab.com/soft/5745.htm

用C實現面向對象
http://download.chinaitlab.com/soft/7566.htm

C語言高級實用編程技巧
http://download.chinaitlab.com/soft/4593.htm

C語言最新編程技巧200例
http://download.chinaitlab.com/soft/4594.htm

C語言速成3.0
http://download.chinaitlab.com/soft/4723.htm

C語言編程技巧程序集
http://download.chinaitlab.com/soft/4561.htm

C語言速成多媒件課件 3.0
http://download.chinaitlab.com/soft/3238.htm

C語言多媒體教程
http://download.chinaitlab.com/soft/2893.htm

C程序設計培訓
http://download.chinaitlab.com/soft/6340.htm

實用C語言詳解
http://download.chinaitlab.com/soft/3274.htm

C語言程序設計及應用實例
http://download.chinaitlab.com/soft/3241.htm

C語言程序寶典
http://download.chinaitlab.com/soft/3071.htm

C語言教程
http://download.chinaitlab.com/soft/3027.htm

《C語言編程寶典》
http://download.chinaitlab.com/soft/1849.htm

C語言常用函數手冊
http://download.chinaitlab.com/soft/1818.htm

C語言學習系統
http://download.chinaitlab.com/soft/1816.htm

C語言技術文章
http://download.chinaitlab.com/soft/1817.htm

C常用演算法程序集
http://download.chinaitlab.com/soft/6225.htm

微軟C編程精粹
http://download.chinaitlab.com/soft/6166.htm

《C++語言專區》

Inside C++ Object Model
http://download.chinaitlab.com/soft/7851.htm

C++ 入門基礎教程
http://download.chinaitlab.com/soft/7617.htm

C++和面向對象的數值計算
http://download.chinaitlab.com/soft/6987.htm

經典C++語言教程
http://download.chinaitlab.com/soft/7399.htm

C++編程實例詳解
http://download.chinaitlab.com/soft/6988.htm

C_C++深層探索
http://download.chinaitlab.com/soft/6989.htm

C_C++程序設計
http://download.chinaitlab.com/soft/6990.htm

C++輸入輸出流及本地化
http://download.chinaitlab.com/soft/6986.htm

經典 C++語言教程
http://download.chinaitlab.com/soft/6978.htm

C++ Primer 3rd Edition
http://download.chinaitlab.com/soft/6823.htm

C++_Primer_Plus_4th
http://download.chinaitlab.com/soft/6819.htm

C++應用編程200例
http://download.chinaitlab.com/soft/6820.htm

C++面向對象高效編程
http://download.chinaitlab.com/soft/6610.htm

Borland C++ 3.0自學培訓教程
http://download.chinaitlab.com/soft/6274.htm

經典 C++ 語言教程
http://download.chinaitlab.com/soft/6600.htm

C++Builder自學培訓教程
http://download.chinaitlab.com/soft/6317.htm

Borland C++ Builder高級編程
http://download.chinaitlab.com/soft/7927.htm

高質量C_C++編程指南
http://download.chinaitlab.com/soft/7916.htm

C++程序設計培訓教程
http://download.chinaitlab.com/soft/6339.htm

C++程序設計教程
http://download.chinaitlab.com/soft/6338.htm

C++Builder核心program
http://download.chinaitlab.com/soft/6318.htm

C++Builder基礎進階
http://download.chinaitlab.com/soft/6316.htm

C++Builder30開發指南

創世紀的C++ Builder教程
http://download.chinaitlab.com/soft/6175.htm

http://download.chinaitlab.com/soft/6311.htm

21天學會C++
http://download.chinaitlab.com/soft/6307.htm

C++程序調試實用手冊
http://download.chinaitlab.com/soft/6131.htm

C++Builder學習大全中文版
http://download.chinaitlab.com/soft/6077.htm

C&C++深層探索
http://download.chinaitlab.com/soft/6036.htm

C++ 設計新思維
http://download.chinaitlab.com/soft/6037.htm

經典C++圖書下載 1
http://download.chinaitlab.com/soft/6067.htm

經典C++圖書下載 2
http://download.chinaitlab.com/soft/6068.htm

C++ 常見問題問與答
http://download.chinaitlab.com/soft/6005.htm

C++ 和面向對象的數值計算
http://download.chinaitlab.com/soft/6006.htm

C++ 面向對象多線程編程
http://download.chinaitlab.com/soft/6007.htm

嵌入式系統中C的開發
http://download.chinaitlab.com/soft/6027.htm

用 C++ 開發 Web 商用程序
http://download.chinaitlab.com/soft/6033.htm

C++名家對話
http://download.chinaitlab.com/soft/5981.htm

C++實踐之路
http://download.chinaitlab.com/soft/6040.htm

C++bulider參考手冊 1.1
http://download.chinaitlab.com/soft/6574.htm

用C++開發Web商用程序
http://download.chinaitlab.com/soft/6975.htm

C++代碼設計與重用
http://download.chinaitlab.com/soft/5980.htm

C++程序設計講義
http://download.chinaitlab.com/soft/5742.htm

《C#語言專區》

C# Primer Plus中文版
http://download.chinaitlab.com/soft/7990.htm

C# 開發編碼規范
http://download.chinaitlab.com/soft/7991.htm

C#深入淺出全接觸
http://download.chinaitlab.com/soft/6992.htm

C# COM+ Programming
http://download.chinaitlab.com/soft/7855.htm

Design Pattern In C#
http://download.chinaitlab.com/soft/7852.htm

C#實現的俄羅斯方塊程序
http://download.chinaitlab.com/soft/7805.htm

C#高級編程第2版
http://download.chinaitlab.com/soft/6883.htm

C#百例
http://download.chinaitlab.com/soft/7638.htm

C#.NET 開發者手冊
http://download.chinaitlab.com/soft/7620.htm

CSharp程序員參考手冊
http://download.chinaitlab.com/soft/7618.htm

C#程序100實例
http://download.chinaitlab.com/soft/7619.htm

新一代C#與ASP.NET權威指南
http://download.chinaitlab.com/soft/4115.htm

C#與.NET技術平台實演練
http://download.chinaitlab.com/soft/4044.htm

C#程序員參考手冊
http://download.chinaitlab.com/soft/6991.htm

C# Network Programming
http://download.chinaitlab.com/soft/7484.htm

C#入門經典
http://download.chinaitlab.com/soft/6570.htm

ASP.NET C#教程
http://download.chinaitlab.com/soft/6640.htm

C#.NET中文版Web服務開發基礎
http://download.chinaitlab.com/soft/3691.htm

精通C#與ASP.NET程序設計
http://download.chinaitlab.com/soft/6578.htm

C#文檔中文版(微軟)
http://download.chinaitlab.com/soft/1839.htm

C#教程
http://download.chinaitlab.com/soft/3070.htm

C#高級編程
http://download.chinaitlab.com/soft/1841.htm

C#進階手冊
http://download.chinaitlab.com/soft/1596.htm

MS Press Inside C#
http://download.chinaitlab.com/soft/4306.htm

C#實常式序
http://download.chinaitlab.com/soft/5586.htm

Windows應用高級編程-C#編程篇
http://download.chinaitlab.com/soft/4992.htm

C#與.NET技術平台實戰演練
http://download.chinaitlab.com/soft/4813.htm

C#語言參考
http://download.chinaitlab.com/soft/4814.htm

C#.NET編程培訓教程
http://download.chinaitlab.com/soft/6331.htm

C# WINDOWS程序設計
http://download.chinaitlab.com/soft/6097.htm

C#系列教程
http://download.chinaitlab.com/soft/6099.htm

C#英文手冊
http://download.chinaitlab.com/soft/5929.htm

精通C#簡體中文版
http://download.chinaitlab.com/soft/6552.htm

C# 參考手冊
http://download.chinaitlab.com/soft/6374.htm

C#語言規范
http://download.chinaitlab.com/soft/6375.htm

C# 程序員介紹
http://download.chinaitlab.com/soft/6356.htm

C# 程序員參考手冊
http://download.chinaitlab.com/soft/6388.htm

C#--微軟.NET的第一語言
http://download.chinaitlab.com/soft/6376.htm

C#基本書寫規范技術文檔
http://download.chinaitlab.com/soft/5660.htm

《VC++語言專區》

VC++與Matlab混合編程的快速實現
http://download.chinaitlab.com/soft/7848.htm

VC++編程指南
http://download.chinaitlab.com/soft/7475.htm

VC++6編程方法
http://download.chinaitlab.com/soft/6352.htm

VC++6.0 類庫參考手冊
http://download.chinaitlab.com/soft/6345.htm

VC++database編程大全
http://download.chinaitlab.com/soft/6348.htm

VC++6.0培訓教程
http://download.chinaitlab.com/soft/6351.htm

VC++編程技巧與範例
http://download.chinaitlab.com/soft/6349.htm

VC++網路教程
http://download.chinaitlab.com/soft/6350.htm

VC++面向對象入門
http://download.chinaitlab.com/soft/6346.htm

VC++擴展編程實例
http://download.chinaitlab.com/soft/6159.htm

用VC++編寫USB介面通信程序
http://download.chinaitlab.com/soft/6073.htm

VC++6.0 語言參考手冊
http://download.chinaitlab.com/soft/5956.htm

VC++6.0內幕
http://download.chinaitlab.com/soft/5959.htm

VC++6.0 運行庫參考手冊
http://download.chinaitlab.com/soft/5957.htm

VC++5.0易學活用
http://download.chinaitlab.com/soft/5954.htm

VC++6.0 用戶界面製作技術與應用實例
http://download.chinaitlab.com/soft/5955.htm

Visual C++6.0從入門到精通
http://download.chinaitlab.com/soft/8645.htm

Visual C++ 6.0 教程
http://download.chinaitlab.com/soft/7974.htm

Visual C++ 6.0 開發寶典
http://download.chinaitlab.com/soft/7973.htm

Visual C++ 6.0實例
http://download.chinaitlab.com/soft/7970.htm

VISUAL C++擴展編程實例
http://download.chinaitlab.com/soft/7606.htm

Visual C++6.0高級編程技巧與實例
http://download.chinaitlab.com/soft/7607.htm

Visual C++ 6.0用戶開發手冊
http://download.chinaitlab.com/soft/7593.htm

瘋狂VC技巧集
http://download.chinaitlab.com/soft/5688.htm

VC模板庫手冊
http://download.chinaitlab.com/soft/5960.htm

用VC開發Activex
http://download.chinaitlab.com/soft/5969.htm

用VC開發CGI
http://download.chinaitlab.com/soft/5970.htm

用VC開發win應用
http://download.chinaitlab.com/soft/5971.htm

VC通訊
http://download.chinaitlab.com/soft/5964.htm

VC入門教程
http://download.chinaitlab.com/soft/5961.htm

VC實例
http://download.chinaitlab.com/soft/5962.htm

VC使用大全
http://download.chinaitlab.com/soft/5963.htm

VC5.0開發人員參考手冊
http://download.chinaitlab.com/soft/5952.htm

跟我學 VISUAL C++ 6.0
http://download.chinaitlab.com/soft/7592.htm

精通Visual C++圖像編程
http://download.chinaitlab.com/soft/7590.htm

Visual C++.NET應用編程150例
http://download.chinaitlab.com/soft/7396.htm

Visual C++ 6.0 高級編程
http://download.chinaitlab.com/soft/6802.htm

Visual C++ 6—24學時學習教程
http://download.chinaitlab.com/soft/6582.htm

Visual C++高級編程技巧與實例
http://download.chinaitlab.com/soft/6554.htm

Visual C++ 設計WIN32應用程序
http://download.chinaitlab.com/soft/6555.htm

Visual C++ 6.0 編程實例與技巧
http://download.chinaitlab.com/soft/6449.htm

Visual C++ 6.0 程序員指南
http://download.chinaitlab.com/soft/6275.htm

Visual C++ 6-24學時學習教程
http://download.chinaitlab.com/soft/6223.htm

Visual C++ - Visual C++
http://download.chinaitlab.com/soft/6063.htm

Visual C++ .net多媒體教學
http://download.chinaitlab.com/soft/1069.htm
VC編程經驗總結
http://download.chinaitlab.com/soft/6160.htm

VC新手學堂
http://download.chinaitlab.com/soft/6090.htm

VC6.0 MFC類庫參考手冊
http://download.chinaitlab.com/soft/6357.htm

VC6.0 運行庫參考手冊
http://download.chinaitlab.com/soft/6355.htm

VC-MFC編程實例
http://download.chinaitlab.com/soft/6354.htm

VC-MFC擴展編程實例
http://download.chinaitlab.com/soft/6353.htm

深入VC編程內幕
http://download.chinaitlab.com/soft/6473.htm

Visual C.NET中文版Web服務開發基礎
http://download.chinaitlab.com/soft/6976.htm

然後還有個C語言網路吧:
http://post..com/f?kz=5728013

參考資料:http://www.programfan.com/blog/article.asp?id=6925

㈥ MATLAB JAVA混合編程效率問題

因為java在打包成為位元組碼後是被jvm解釋執行的。

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:746
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:1007
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:715
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:875
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:774
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1122
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:347
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:225
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:911
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:873