read files from 1 dic

1 ビュー (過去 30 日間)
Rita Barnabé
Rita Barnabé 2021 年 11 月 6 日
コメント済み: Rik 2021 年 11 月 7 日
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)
Error using cd
Unable to change current folder to '/users/mss.system.uICeX0/C:\Users\35191\OneDrive - Universidade de Aveiro\Emotional transition - recognition\Dados_Sessoes\S1.mat' (Name is nonexistent or not a folder).
%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
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 件)

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by