필터 지우기
필터 지우기

expot to excel file

조회 수: 2 (최근 30일)
Olga
Olga 2012년 3월 11일
I'm looking for some help about what should I do to export to excel file (preferably) all the results from my GUI. I mean the counted parameters and the plots. Can u help me with this?
That's how I'm doing the analysis and this is what I would like to export to excel file:
%handles.R_loc;
%handles.R_valu;
a1=handles.R_loc(1:end-1)/handles.fs;
a2=handles.R_loc(2:end)/handles.fs;
odstepRR=a2-a1;
% meanNN
meanNN=mean(odstepRR);
set(handles.meanNN, 'string', num2str(meanNN*1000));
%minNN
minNN=min(odstepRR);
set(handles.minNN, 'string', num2str(minNN*1000));
%maxNN
maxNN=max(odstepRR);
set(handles.maxNN, 'string', num2str(maxNN*1000));
%HR
hr=60./(odstepRR./1000);
HR=round(mean(hr))/1000;
set(handles.hr, 'string', num2str(HR));
% SDNN
SDNN=std(odstepRR);
set(handles.sdnn,'string',num2str(SDNN*1000)); % mnozymy przez 1000 bo jest w ms
% RMSSD
RMSSD=sqrt(sum(((mean(odstepRR)-odstepRR).^2))/length(odstepRR-1));
set(handles.rmssd,'string',num2str(RMSSD*1000)); % mnozymy przez 1000 bo jest w ms
% NN50
o1=odstepRR(1:end-1);
o2=odstepRR(2:end);
roznica_odstepowRR=o2-o1;
ss=zeros(1,length(o2));
ss(abs(roznica_odstepowRR)>0.05)=1;
NN50=sum(ss);
set(handles.nn50,'string',num2str(NN50));
%pNN50
pNN50=NN50/length(odstepRR);
set(handles.pnn50,'string',num2str(pNN50*100)); % * 100 bo mają być %
%Poincare plot
xp=odstepRR;
xp(end)=[];
xm=odstepRR;
xm(1)=[];
%SD1
SD1 = std(xp-xm)/sqrt(2);
set(handles.sd1, 'string', num2str(SD1*1000));
%SD2
SD2 = std(xp+xm)/sqrt(2);
set(handles.sd2, 'string', num2str(SD2*1000));
%SDRR
SDRR=sqrt(SD1^2+SD2^2)/sqrt(2);
set(handles.sdrr, 'string', num2str(SDRR*1000));
axes(handles.axes4);
set(handles.text44, 'visible', 'on')
plot(xm,xp,'.')
psdest = dspdata.psd(odstepRR, 'Fs',400);
TP = avgpower(psdest,[0.0 0.4]);
set(handles.tp, 'string', num2str(TP));
ULF = avgpower(psdest, [0.0 0.0033]);
set(handles.ulf, 'string', num2str(ULF));
VLF = avgpower(psdest, [0.0033 0.04]);
set(handles.vlf, 'string', num2str(VLF));
LF = avgpower(psdest, [0.04 0.15]);
set(handles.lf, 'string', num2str(LF));
HF = avgpower(psdest, [0.15 0.4]);
set(handles.hf, 'string', num2str(HF));
LFHF = LF/HF;
set(handles.lf_hf, 'string', num2str(LFHF));
axes(handles.axes5);
set(handles.text45, 'visible', 'on')
set(handles.axes5, 'visible', 'on')
plot(psdest)
%plot(freq,10*log10(psdest));
grid on;
guidata(hObject, handles);

채택된 답변

Image Analyst
Image Analyst 2012년 3월 11일
Get your data into a numerical array, or a cell array, and then call xlswrite(). If you need to do this many times, you'll want to use ActiveX for speed. it's more complicated though. Let me know if you want ActiveX demo code.
  댓글 수: 2
Olga
Olga 2012년 3월 12일
Thank you very much. ;)
Okey, I've done a cell array from my data. But how should I do this so that each time it is saved as a new excel file (doesn't overwrite previous)? Or so that the file is saved in Current DIrectory whatever it is (because I need to use it on various computers)? Is it possible?
I've done it like this:
wyniki = struct2cell(wynik);
savefile2 = 'wynikianalizy.dat';
save(savefile2, 'wyniki')
xlswrite('C:\Users\Owu\Documents\INŻ INŻ INŻ\inżynierka bangla\program 1.7\wynikianalizy.xls', wyniki, 'B1:B17');
Image Analyst
Image Analyst 2012년 3월 12일
Don't use save() - that saves it to a mat file - unless you want both an Excel and a mat file. Use xlswrite like you're doing but make sure to specify the full file name (folder + base filename). I would not use cd in your m-file. See the FAQ: http://matlab.wikia.com/wiki/FAQ#Where_did_my_file_go.3F_The_risks_of_using_the_cd_function.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

kyioshi hyb
kyioshi hyb 2012년 12월 8일
Hi,
Where did you get the handles function? Im a litle lost but i need to calculate the parameters for ECG signal and i dont know how
  댓글 수: 1
Image Analyst
Image Analyst 2012년 12월 10일
It's created when you develop a GUI with GUIDE.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by