read files from 1 dic
1 ビュー (過去 30 日間)
表示 古いコメント
Hi, i want to read various files from 1 past
but i have this error:
Instead its type was struct.
Error in interp (line 47)
validateattributes(idata,{'single','double'},{'vector'},'interp','x');
Error in Untitled_interpolar (line 33)
ecg_new = interp(ecg,5);
clear, close
clc
path_dados_originais = "C:\Users\35191\OneDrive - Universidade de Aveiro\Emotional transition - recognition\Dados_Sessoes\S1.mat";
path_dados_interpolados = "C:\Users\35191\OneDrive - Universidade de Aveiro\Emotional transition - recognition\Dados_Sessoes\S1_interpolados";
cd(path_dados_originais)
%Ficheiros a usar:
allfiles = dir;
Nfiles = size(allfiles(3:end,1),1);
% Transformação de .txt para .mat
% for idx = 1:length(allfiles)
% file_name = allfiles(idx).name;
%
% fprintf("Processing File %s\n",file_name);
% data = importdata(file_name);
% [filepath,name,ext] = fileparts(fullfile(pwd,file_name));
% save([name '.mat'],'data');
% end
for j=1:Nfiles
cd(path_dados_originais)
%Ler os dados
file = allfiles(j+2).name;
eval(['load ' file ])
ecg = data(:,1);
ecg_new = interp(ecg,5);
cd(path_dados_interpolados)
mat_dados = [ecg_new];
eval(['save' file(1:end-4) ' mat_dados'])
end
1 件のコメント
Rik
2021 年 11 月 7 日
Why are you using this fragile code design with eval? Also, none of the code indicates what could be the source of the problem, so you will have to attach one of your mat files and explain what you want to happen.
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!