Why is my CSV reader not working?
1 回表示 (過去 30 日間)
古いコメントを表示
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]);
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!