Why is my CSV reader not working?

6 次查看(过去 30 天)
onamaewa
onamaewa 2019-2-18
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]);

回答(1 个)

Image Analyst
Image Analyst 2019-2-18
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.

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by