How to import data into a dataset from a space-delimited ascii file.
이전 댓글 표시
I have several large (10's and 100's of MByte) ascii files. First row contains variable names. Rest are data. All arranged in columns. Example file is attached. Variables are mix of floats, integers, binary and hex. If I use interactive Import Data and choose 'dataset' with everything else set to defaults, this always works. Would like to do the same thing, but by program. I like the dataset approach because of the dot subscripting and the import seems quick.
But, the closest I can get to success is below, but gives the following errors...
K>> ctlset = dataset('File',[name, '_CtlDat1.dat'],'VarNames',true,'Delimiter',' '); Error using dataset/readFile>tdfread (line 302) Requires the same number of delimiters on each line.
Error in dataset/readFile (line 163) raw = tdfread(file,delimiter,tdfreadHeaderLines,treatAsEmpty);
Error in dataset (line 347) a = readFile(a,fileArg,otherArgs);
채택된 답변
추가 답변 (1개)
Image Analyst
2015년 10월 13일
0 개 추천
No data file was attached. Did you remember to click the "Attach file" button after you clicked the "Choose file" button?
Have you tried readtable() or dlmread()?
카테고리
도움말 센터 및 File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!