csv fileを読み込めない
Afficher commentaires plus anciens
%フォルダ内のCSVファイルを読み込み
files = dir('*.csv');
%出力用フォルダがなければ作成
if
exist('output') == 0
mkdir 'output';
end
for n=1:length(files);
%ファイルの情報の取得
[path, name, ext] = fileparts(files(n).name);
%データの読み込みと分割
time=csvread(files(n).name, 5, 0, [5 0 2052 0]);
ax=csvread(files(n).name, 5, 1, [5 1 2052 1]);
ay=csvread(files(n).name, 5, 2, [5 2 2052 2]);
az=csvread(files(n).name, 5, 3, [5 3 2052 3]);
%ワークスペースの変数にデータをコピー
eval(['Time', int2str(n), ' = time;']);
eval(['Ax', int2str(n), ' = ax;']);
eval(['Ay', int2str(n), ' = ay;']);
eval(['Az', int2str(n), ' = az;']);
%outputフォルダに書き出し
csvwrite(strcat('output\', name, 'time.csv'), time);
csvwrite(strcat('output\', name, 'Ax.csv'), ax);
csvwrite(strcat('output\', name, 'Ay.csv'), ay);
csvwrite(strcat('output\', name, 'Az.csv'), az);
end
実行すると
エラーメッセージ
エラー: dlmread (line 165)
内部サイズの不一致
エラー: csvread (line 50)
m=dlmread(filename, ',', r, c, rng);
エラー: csv_read_ind (line 14)
time=csvread(files(n).name, 5, 0, [5 0 2052 0]);
が返ってきます 以前使用していた
%データの読み込みと分割
time=csvread(files(n).name, 4, 0, [4 0 515 0]);
ax=csvread(files(n).name, 4, 1, [4 1 515 1]);
ay=csvread(files(n).name, 4, 2, [4 2 515 2]);
az=csvread(files(n).name, 4, 3, [4 3 515 3]);
では作動していましたどう変更すれば作動するでしょうか
1 commentaire
michio
le 7 Sep 2018
読みやすくなるようコード表示を編集いたしました。
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!