Export to excel from matlab
Show older comments
Hello, I have a script that runs all the text filles, that containes a signal, in one folder and calculates the amplitude for all.
I want so save those amplitudes in excel, but when I tried it only saves the amplitude of the last signal, like in the image, instead of all the amplitudes for all the signals.
I hope you can help me, thank you very much!

%%
paste = '/Users/sofiasantos/Desktop/sinais'; %directory
data=dir(fullfile(paste,'*.txt'));
for k=1:numel(data)
signal=data(k).name
data_org = importdata(signal,'\t',7); %text file with 7 columms
EDA=data_org.data;
EDA= EDA(:,6); %I only want the 6 collum of the text file
EDAuS=((EDA/2^10)*3)/0.12; %convert to uS
N= length(EDAuS);
fs = 1000;
T=N/fs;
t = (0:N-1)/fs; %time
f = (0:N-1)/T;
%%
[b,a] = butter(6,0.0035,'low');
EDAuS_filter = filtfilt(b,a,EDAuS); %filtering signal EDA
minimo= min(EDAuS_filter);
maximo= max(EDAuS_filter);
amp=abs(maximo-minimo);
disp('amplitude='); disp(amp); %amplitude da SCR
%% Export to excel
T = table(amp,'RowNames',{signals});
fileName='signals_EDA.xlsx';
writetable(T,fileName);
end
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!