[問題] GetPulseAscii讀檔問題已回收
請問各位高手
有沒有人利用MATLAB擷取過B&K3560C的頻譜分析儀的DATA呢?
因為要利用MATLAB對PULSE直接進行控制以及將測量出來的DATA直接存檔
並且匯入自行撰寫的GUI程式分析
在PULSE Labshop的軟體中有一個M檔案,裡面的程式如下
% Bruel & Kjaer PULSE control through Matlab
% Mehdi Batel March 2003
clear;close all;
h=actxserver('Pulse.Labshop.Application'); % PULSE as Activex server
%h=COM.pulse.labshop.application
get(h,'visible'); %gets PULSE visible
set(h,'visible',1);
myproject=invoke(h,'OpenProject','c:\test.pls',0,0);
mo=get(myproject,'MeasurementOrganiser');
htemplates=get(mo, 'Templates', 'Working');
hsetup = get(htemplates,'Setup');
FFTAnalz= get(hsetup, 'Instruments', 'FFT Analyzer');
FFTState=get(FFTAnalz,'AnalyzerState');
FFTspan=input('Please enter the frequency span of analysis: ');
set(FFTAnalz, 'Span', FFTspan);
FFTlines=input('Please enter the number of FFT lines in the analysis: ');
set(FFTAnalz, 'Lines',FFTlines);
FFTaverages=input('Please enter the number of averages in the analysis: ');
set(FFTAnalz, 'Averages',FFTaverages);
%start the measurement
invoke(h,'Start')
fo=get(myproject,'FunctionOrganiser');
fungr=get(fo,'FunctionGroups','Function Group');
pause(5);
%gets the state of the analyzer
FFTState=get(FFTAnalz,'AnalyzerState');
%gets the microphone spectrum when analyzer finished
if (FFTState==1) or (FFTState==6)
disp('The FFT Analyzer is finished')
disp('Press Enter to get the microphone spectrum values')
pause
func=get(fungr,'Functions','Autospectrum(Sound) - Input');
spec=get(func,'GetPulseAscii');
save('c:\spectrum data','spec');
x=extractinfo(spec); % uses extractinfo function for separating data fields
semilogy(x.Data(:,2),x.Data(:,3));
xlabel('Frequency (Hz)');ylabel('dB');title('Microphone signal'); grid on
end
而我現在的問題在於,在spec=get(func,'GetPulseAscii');這行
因為如果直接這樣輸入會出現錯誤
而MATLAB裡面的GetPulseAscii後面是要輸入檔名....變成GetPulseAscii(檔名)
這裡應該要放入甚麼檔案呢?
因為這行如果不能執行...就不能到下一行的SAVE
懇請各位高手幫忙....這裡已經卡關卡很久了
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.130.89.153