2024年4月11日发(作者:)
先说一下字符串,字符串在matlab中需要加单引号,你直接使用newData1=
importdata();
matlab便会将看成是变量,但是importdata需要一个包含文件名的字符串变量,
但是不知道是什么东西,所以会出现???Undefinedvariable"DOW"orclass
"".
正确的使用方法是:
newData1=importdata('');
或者
path=''
newData1=importdata(path);
不过importdata不支持后缀名为txt文件,其支持的文件后缀有:
Dataformats
MAT
CSV
DAT
DLM
-MATLABworkspace
-Commaseparatednumbers
-Formattedtext
-Delimitedtext
Command
load
csvread
Returns
Variablesinfile.
Doublearray.
Doublearray.
Doublearray.
importdataDoublearray.
dlmread
dlmreadTAB-Tabseparatedtext
Spreadsheetformats
XLS-Excelworksheet
WK1-Lotus123worksheet
xlsread
wk1read
Doublearrayandcellarray.
Doublearrayandcellarray.
Scientificdataformats
CDF
HDF
-CommonDataFormat
-HierarchicalDataFormat
cdfread
fitsread
hdfread
CellarrayofCDFrecords
HDForHDF-EOSdataset
FITS-FlexibleImageTransportSystemPrimaryorextensiontabledata
Movieformats
AVI-MovieavireadMATLABmovie.
Imageformats
TIFF-TIFFimage
image(s).
PNG
image.
HDF-HDFimageimreadTruecolororindexedimage(s).
-PNGimageimreadTruecolor,grayscaleorindexed
imreadTruecolor,grayscaleorindexed
BMP
GIF
PCX
CUR
ICO
RAS
PBM
PGM
PPM
-BMPimage
-GIFimage
-PCXimage
-Cursorimage
-Iconimage
-Sunrasterimage
-PBMimage
-PGMimage
-PPMimage
imread
imread
imread
imread
imread
imread
imread
imread
imread
imread
imread
Truecolororindexedimage.
Truecolororgrayscaleimage.
Indexedimage.
Indexedimage.
Indexedimage.
Indexedimage.
Indexedimage.
Truecolororindexed.
Grayscaleimage.
Grayscaleimage.
Truecolorimage.
JPEG-JPEGimage
XWD-XWDimage
Audioformats
AU
SND
WAV
-NeXT/Sunsound
-NeXT/Sunsound
-MicrosoftWavesound
auread
auread
wavread
Sounddataandsamplerate.
Sounddataandsamplerate.
Sounddataandsamplerate.
发布评论