我在Matlab中制作了一个过滤脚本。我无法将顺序文件的输出保存为dat。文件夹中的文件。错误消息是“使用保存时出错”。文件名太长了“。拜托,有人可以告诉我这个问题吗?谢谢布鲁诺
%Filtering EMG data
%%Load EMG file data
directory_name=uigetdir(pwd,'Select data directory');
directory_name=([directory_name '\']);
% directory_save=uigetdir(pwd,'Select save directory');
% directory_save=([directory_save '\']);
disp(directory_name)
mkdir(directory_name,'FilterHere');
directory_save=([directory_name,'FilterHere\']);
files=dir([directory_name,'*.dat']);
if isempty(files)
msgbox('No raw files in this directory');
end
counter = 0;
for i_files=1:length(files);
filename=files(i_files).name;
[path,filename,ext] = fileparts(filename);
file = fullfile(directory_name,[filename,'.dat']);
counter = counter + 1;
disp([filename,'(',num2str(i_files),'of', num2str(length(files)), ')'])
i_u=(strfind(filename,'_'))-1;
numbers=dlmread(file);
data=numbers(:,1);
end
FileNum=1:i_files;
for filtLow = 10;
filtHigh = 500;
Fs = 2000;
[b, a] = butter(1, [filtLow/(Fs/2), filtHigh/(Fs/2)]);
Filter = (filtfilt(b, a,data))';
dimstr=num2str(Filter);
save_data=fullfile(directory_save,[filename,'_',dimstr,'dat']);
save(save_data,'Filter', '-ASCII');
end