help using dlmread/csvread please
Show older comments
All,
I thought this would be an easy one but after 45 minutes of trying I can't seem to read in my .csv file. I've been trying to use dlmread as most of the file is non-numeric (and csvread seems to just dlmread anyway)
Heres a section of the file (each column has 14 entries):
Protocol ID,Protocol name,Measurement date & time,Completion status,Run ID,Rack,Det,Pos,Time,Sample code,F-18 Counts,F-18 CPM,F-18 Error %,F-18 Info
19,18F-any,15/03/2013 14:02,0,164,1,1,1,180.05,,10613633.53,5364219.76,0.04,
19,18F-any,15/03/2013 14:02,0,164,1,2,2,180.05,,10743127.87,5508950.9,0.04,
19,18F-any,15/03/2013 14:02,0,164,1,3,3,180.05,,3868341.08,1354963.52,0.08,
19,18F-any,15/03/2013 14:02,0,164,1,4,4,180.05,,10987871.62,5439457.84,0.04,R
19,18F-any,15/03/2013 14:02,0,164,1,5,5,180.05,,6897896.87,3352857.77,0.05,
If I want the contents of the 3rd row, 4th column (zero-based), I type
val = dlmread('000164.csv', ',', 2, 5);
and the error I receive is
Error using dlmread (line 139)
Mismatch between file and format string.
Trouble reading number from file (row 3u, field 14u) ==> R\n
I'm basically looking for only 1 column from this file, but I've got hundreds of these files so I'd like to automate it
Any help greatly appreciated!
Jim
Accepted Answer
More Answers (1)
durga ganesan
on 21 Feb 2016
0 votes
i run my matlab code show this error so how i solve this "Error using textscan Mismatch between file and format string. Trouble reading floating point number from file (row 10u, field 2u) ==> ';\n
Error in park (line 51) dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1, 'ReturnOnError', false);"
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!