Borrar filtros
Borrar filtros

Import csv in matlab

1 visualización (últimos 30 días)
elisa ewin
elisa ewin el 8 de Feb. de 2017
Comentada: per isakson el 9 de Feb. de 2017
Hi! I have 29 csv file and I want to import them in Matlab. To read a single csv file, I have created this code:
Data = fileread('raffacama.csv');
Data = strrep(Data, ',', '.');
FID = fopen('raffacama2.csv', 'w');
fwrite(FID, Data, 'char');
fclose(FID);
% Import data
data=importfile('raffacama2.csv');
but I want to import simultaneously all 29 csv, so I have tried to modify the code but I have a problem
files=dir('*.csv');
for i=1:29
Users(i).Data = fileread(files(i).name);
end
All Users.Data have the values of last files.name: I don't understand why! Can you help me? Thanks
  5 comentarios
elisa ewin
elisa ewin el 8 de Feb. de 2017
this is my problem: all Users.Data have the values of last files.name and it's not right. I think the problem is clear!
per isakson
per isakson el 9 de Feb. de 2017
The only explanation to your problem that I can think of is: All csv-file in question are identical

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by