How can I use csvread to read the first 2 columns of a file with variable number of rows?
Mostrar comentarios más antiguos
I have a csv file that I need to read that has 3 columns (first 2 are data, third is text), but I only want to read in the first 2 columns. There are an unknown number of rows. I tried specifying a RANGE such as [0, 0, :, 1], but that throws a syntax error. Is this something that's possible with a standard csvread call, or do I need to dlmread or textscan everything, then throw out the stuff I don't want?
EDIT: I've also tried using a RANGE of [0, 0, inf, 1], but that seems to still be trying to read the third column, which is text, and throws the error:
Error using dlmread (line 139)
Mismatch between file and format string.
Trouble reading number from file (row 1u, field 3u) ==> Shot 1\n
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Text Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!