Loading CSV file (date column A, identifier row, rest data)

I want to Import the attached csv with following Code:
>> d = dbload('data_US.csv');
If I then check for the variable d, it shows correctly 13 fields, but each of the fields contains only NaN's
Thank you very much

4 comentarios

What’s ‘dbload’? I can’t find it in the online documentation.
Oli
Oli el 16 de Mzo. de 2016
Thank you very much. I am using a code which is partly based on the IRIS toolbox (trying to reproduce a result from a scientific paper which employs IRIS). If you could suggest another command that uploads the file (column A are dates, row 1 beginning in B1 are headers of the columns) into the workspace, it would be equally fine for me. For some reason, the time series appears in the workspace with the correct names, but shows NaN if I open it(even though matlab recognizes the various data format e.g. "Covert to Number" when I open the file in the folder structure)
There are several options: xlsread, textscan, readtable and others.
Oli
Oli el 24 de Mzo. de 2016
Thank you very much!

Iniciar sesión para comentar.

 Respuesta aceptada

Daniel LaCroix
Daniel LaCroix el 16 de Mzo. de 2016
There is a function called csvread that should load the file.
If your file has headers (or anything other than numbers), the command won't work. To get around this, set it to have an offset of one row (and no column offset).
data=csvread('data_US.csv') or data=csvread('data_US.csv',1,0)
You can also select a more specific range of data if you need to, so check out the documentation if that's something you want to do.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

Oli
el 15 de Mzo. de 2016

Editada:

el 9 de Mayo de 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by