PDA

查看完整版本 : 【求助】如何用Matlab处理大量数据


ghmnjtu
2007-05-22, 11:53
我要用Matlab处理大量数据,一个个输入肯定不现实,请问 怎么在主程序中引用.txt的数据文件?

chenhuips2
2007-05-22, 15:10
我要用Matlab处理大量数据,一个个输入肯定不现实,请问 怎么在主程序中引用.txt的数据文件?

输入:help iofun
得到结果:
File input/output.

File import/export functions.
dlmread - Read delimited text file.
dlmwrite - Write delimited text file.
load - Load workspace from MATLAB (MAT) file.
importdata - Load workspace variables disk file.
wk1read - Read spreadsheet (WK1) file.
wk1write - Write spreadsheet (WK1) file.
xlsread - Read spreadsheet (XLS) file.

Image file import/export.
imfinfo - Return information about graphics file.
imread - Read image from graphics file.
imwrite - Write image to graphics file.
im2java - Convert image to Java image.

Internet resource.
urlread - Read the contents of a URL into a string.
urlwrite - Write the contents of a URL to a local file.
sendmail - Send e-mail.

Zip file access.
zip - Compress files into a zip file.
unzip - Extract the contents of a zip file.

Audio file import/export.
auread - Read NeXT/SUN (AU) sound file.
auwrite - Write NeXT/SUN (AU) sound file.
wavread - Read Microsoft WAVE (WAV) sound file.
wavwrite - Write Microsoft WAVE (WAV) sound file.

Video file import/export.
aviread - Read movie (AVI) file.
aviinfo - Return information about AVI file.
avifile - Create a new AVI file.
movie2avi - Create AVI movie from MATLAB movie.

Formatted file I/O.
fgetl - Read line from file, discard newline character.
fgets - Read line from file, keep newline character.
fprintf - Write formatted data to file.
fscanf - Read formatted data from file.
input - Prompt for user input.
textread - Read formatted data from text file.

String conversion.
sprintf - Write formatted data to string.
sscanf - Read string under format control.
strread - Read formatted data from text string.

File opening and closing.
fopen - Open file.
fclose - Close file.

Binary file I/O.
fread - Read binary data from file.
fwrite - Write binary data to file.

File positioning.
feof - Test for end-of-file.
ferror - Inquire file error status.
frewind - Rewind file.
fseek - Set file position indicator.
ftell - Get file position indicator.

File name handling
fileparts - Filename parts.
filesep - Directory separator for this platform.
fullfile - Build full filename from parts.
matlabroot - Root directory of MATLAB installation.
mexext - MEX filename extension for this platform.
partialpath - Partial pathnames.
pathsep - Path separator for this platform.
prefdir - Preference directory name.
tempdir - Get temporary directory.
tempname - Get temporary file.

CDF file handling
cdfread - Read data from a CDF file.
cdfinfo - Get information from a CDF file.
cdfwrite - Write data to a CDF file.
cdfepoch - Construct cdfepoch object.

HDF library interface help.
hdf - MEX-file interface to the HDF library.
hdfan - MATLAB Gateway to HDF multifile annotation interface.
hdfdf24 - MATLAB Gateway to HDF raster image interface.
hdfdfr8 - MATLAB Gateway to HDF 8-bit raster image interface.
hdfh - MATLAB Gateway to HDF H interface.
hdfhd - MATLAB Gateway to HDF HD interface.
hdfhe - MATLAB Gateway to HDF HE interface.
hdfml - MATLAB-HDF gateway utilities.
hdfsd - MATLAB Gateway to HDF multifile scientific dataset interface.
hdfv - MATLAB Gateway to HDF V (Vgroup) interface.
hdfvf - MATLAB Gateway to HDF VF (Vdata) interface.
hdfvh - MATLAB Gateway to HDF VH (Vdata) interface.
hdfvs - MATLAB Gateway to HDF VS (Vdata) interface.

HDF-EOS library interface help.
hdfgd - MATLAB Gateway to HDF-EOS grid interface.
hdfpt - MATLAB Gateway to HDF-EOS point interface.
hdfsw - MATLAB Gateway to HDF-EOS swath interface.

XML file handling
xmlread - Parse an XML file and return a Document Object Model node.
xmlwrite - Serialize an XML Document Object Model node.
xslt - Transform an XML document using an XSLT engine.

Serial port support.
serial - Construct serial port object.

Timer support.
timer - Construct timer object.

Command window I/O
clc - Clear command window.
disp - Display array.
home - Send cursor home.
input - Prompt for user input.
pause - Wait for user response.

FIG file support for plotedit and printframes.
hgload - Loads a Handle Graphics object from a file.
hgsave - Saves an HG object hierarchy to a file.

Utilities.
str2rng - Convert spreadsheet range string to numeric array.
wk1const - WK1 record type definitions.
wk1wrec - Write a WK1 record header.


没看到可以直接读取TXT文件,
但是可以直接读取XLS文件,
使用xlsread(‘文件名’)命令读取。

spy1120
2007-05-23, 10:42
你可以把txt格式的后缀名改为dat,
比如a.txt改为a.dat,
然后把它放到matlab里面的一个叫work的文件夹里面
再然后在matlab里面用“load a.dat”命令载入就可以了