Why is my CSV reader not working?

6 visualizaciones (últimos 30 días)
onamaewa
onamaewa el 18 de Feb. de 2019
Respondida: Image Analyst el 18 de Feb. de 2019
clc; clear;
% Path to Data Files.
path = "C:/Users/Desktop/File Names";
% Number of F & G.
No_F = 32; No_G = 32;
% Defines the first ten file names by adding the '0' infront of the file number.
for i = 0:9;
fname(i + 1) = strcat("i_0", string(i), ".CSV");
fnamelabel(i + 1) = strcat("i\_0", string(i));
end
% Defines the rest of the file names using the given file number.
for i = 10:No_F-1;
fname(i + 1) = strcat("i_", string(i), ".CSV");
fnamelabel(i + 1) = strcat("i\_", string(i));
end
% Reads the time column from the first measurement.
% time = csvread(strcat(path,fname(1)),1,0,[1,0,10000,0]);
time = csvread('i_00.CSV', 1, 0, [1, 0, 10000, 0]);
for i = 1:No_F;
temp = strcat(path, fname(i));
data(:,:,i) = csvread(temp, 1, 1, [1, 1, 10000, No_F]); %%%% Error using csvread, File not found.
end
The line that doesn't work is:
data(:,:,i) = csvread(temp, 1, 1, [1, 1, 10000, No_F]);

Respuestas (1)

Image Analyst
Image Analyst el 18 de Feb. de 2019
It's probably not a csv file. Try importdata() instead. Attach one of the CSV files that it fails on if importdata() does not work.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by