¿Cómo puedo importar una señal que tengo guardada en formato csv?

9 vues (au cours des 30 derniers jours)
Florentino Ruiz
Florentino Ruiz le 23 Mar 2011
El problema que tengo es que ya hice las mediciones y estan guardadas en formato csv, ahora bien, quiero hacer un código que me permita abrir el explorador de windows para elegir la carpeta de origen de mis archivos, luego que me permita importar un archivo xxx.csv que tiene 8 filas de encabezado (En la fila 9 empiezan mis datos) y crear una variable para cada una de las dos columnas de mi información (Vector de tiempo y vector de datos). Como puedo hacerlo, o existe otro método?
Gracias a todos.
The problem I have is that I did the measurements and are saved in csv format, however, I have a code that allows me to open the Windows Explorer to select the source folder of my files, then allow me to import a file xxx . csv, who is 8 header row (row 9 start As my Data) and create a variable for each of the two columns of my information (time vector and vector of data). How I can do, or does there another method?
Thank you all.

Réponse acceptée

Anathea Pepperl
Anathea Pepperl le 23 Mar 2011
You can either use csvread or textscan. With csvread, you can use:
data = csvread('xxx.csv', 9, 0)
var1 = data(:,1);
var2 = data(:,2);
so that you start reading data on row 9, column 0 in order to avoid reading the 8 header lines in the beginning.
If you want to use textscan,
fid = fopen('xxx.csv');
C = textscan(fid, 'format', 'HeaderLines', 8);
var1 = C{1};
var2 = C{2};
Considering that it seems you seem to be importing heterogeneous data (different data types), I would recommend trying textscan. Depending on how your time vector is imported, you may need to use the datevec function as well.

Plus de réponses (1)

Sean de Wolski
Sean de Wolski le 23 Mar 2011
My spanish is pretty poor but I'm going to guess you want to look at
doc csvread

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by