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

10 ビュー (過去 30 日間)
Florentino Ruiz
Florentino Ruiz 2011 年 3 月 23 日
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.

採用された回答

Anathea Pepperl
Anathea Pepperl 2011 年 3 月 23 日
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.

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2011 年 3 月 23 日
My spanish is pretty poor but I'm going to guess you want to look at
doc csvread

カテゴリ

Help Center および File ExchangeStandard File Formats についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by