文档介绍:第三章 MATLAB程序设计基础
chapter 3: Foundation of MATLAB program design
数据及数据文件(Data and Data file)
1. 数据类型:(Data mode) 用于编程和计算的数据类型(表 3—1)
数组:
字符数组(Character array)、
数值数组(Numeric array)—
包括整形(int8,uint8,int16,uint16,int32,uint32)单精度(signal), 双精度(duble)(MATLAB最常用的变量类型),稀疏(sparce)数组。、
Int--- Integrate.
Uint---Unsigned INTeger data
单元数组(Cell array)、
结构数组(Structure array)
Java类(Java class)
函数句柄(Function handle)
在工作空间浏览器中不同的数据类型有着不同的图标标识,(见图 3—2)_
2. 数据文件(Data file)
MATLAB支持的各种数据文件(Readable file formats of MATLAB)及其调用方法和返回值见(表 3—2)
(1)二进制数据文件:(Binary date file) 。是标准的MATLAB数据文件,以二进制编码形式存储。.mat文件可以由MATLAB提供的save和load命令直接存取。
(2)ASCⅡ码数据文件:(ASCⅡ code data file)扩展名为
.txt, .dat等, 可以是在MATLAB环境下存储的,也可能是其他软件的计算结果,可以被MATLAB调用,也可以用文本编辑器打开进行观察与修改。可以用save和load命令进行读入和存取。
(3).图象文件:(Graphics file) , .jpg .tif等,用于图形图象处理,可以用imread和imwrite命令进行读入和存取。
(4).声音文件: (Sound file) ,用waveread 和 wavwrite命令进行读入和存取。
Readable file formats.
Data mand Returns
MAT- MATLAB workspace load Variables in file.
CSV- Comma separated numbers csvread Double array.
DAT- Formatted text importdata Double array.
DLM- Delimited text dlmread Double array.
TAB- Tab separated text dlmread Double array.
Spreadsheet formats
XLS - Excel worksheet xlsread Double array and cell array.
WK1- Lotus 123 worksheet wk1read Double array and cell array.
Scientific data formats
CDF - Common Data Format cdfread Cell array of CDF records
FITS- Flexible Image Transport System fitsread Primary or extension table data
HDF - Hierarchical Data Format hdfread HDF or HDF-EOS data set
Movie formats
AVI - Movie aviread MATLAB movie.
Image formats
TIFF - TIFF image imread Truecolor, grayscale or indexed image(s).
PNG - PNG image imread Truecolor, grayscale or indexed image.
HDF - HDF image imread Truecolor or indexed image(s).
BMP - BMP image imread Truecolor or indexed image.
JPEG - JPEG image imread Truecolor or grayscale image.
GIF - GIF image imread Indexed image.
PCX - PCX image