當前位置:編程學習大全網 - 源碼下載 - matlab的矩陣類型在java中如何訪問?

matlab的矩陣類型在java中如何訪問?

用命令load

句法有以下幾種

load('filename')

load('filename', 'X', 'Y', 'Z')

load('filename', '-regexp', exprlist)

load('-mat', 'filename')

load('-ascii', 'filename')

S = load(...)

load filename -regexp expr1 expr2 ...

舉例:

Example 1 -- Loading From a Binary MAT-fileTo see what is in the MAT-file prior to loading it, use whos -file: whos -file mydata.mat

Name Size Bytes Class

javArray 10x1 java.lang.Double[][]

spArray 5x5 84 double array (sparse)

strArray 2x5 678 cell array

x 3x2x2 96 double array

y 4x5 1230 cell array

Clear the workspace and load it from MAT-file mydata.mat: clear

load mydata

whos

Name Size Bytes Class

javArray 10x1 java.lang.Double[][]

spArray 5x5 84 double array (sparse)

strArray 2x5 678 cell array

x 3x2x2 96 double array

y 4x5 1230 cell array

Example 2 -- Loading From an ASCII File Create several 4-columnn matrices and save them to an ASCII file: a = magic(4); b = ones(2, 4) * -5.7; c = [8 6 4 2];

save -ascii mydata.dat

Clear the workspace and load it from the file mydata.dat. If the filename has an extension other than .mat, MATLAB assumes that it is ASCII: clear

load mydata.dat

MATLAB loads all data from the ASCII file, merges it into a single matrix, and assigns the matrix to a variable named after the filename: mydata

mydata =

16.0000 2.0000 3.0000 13.0000

5.0000 11.0000 10.0000 8.0000

9.0000 7.0000 6.0000 12.0000

4.0000 14.0000 15.0000 1.0000

-5.70

  • 上一篇:linux解壓gz文件的命令linux解壓.gz
  • 下一篇:剪映app怎麽制作氣泡文字效果?剪映氣泡文字效果制作方法
  • copyright 2024編程學習大全網