Reg PSD function and pwelch

Hello :
I'm using the following function code to plot my eeg signal data into spectrogram. This function code is given by my friend. when i'm executing it , i'm getting an error in 54th line. I dont know how to correct it , i dont know where the error has come from. Kindly help.
function MakeEEGFile_AVR(tank, block, EEGChans)
AnalysisLoc='C:\Users\Nishanth\Documents\MATLAB'; %CHANGE to where Analysis should be saved SaveDir=[AnalysisLoc,tank,'\block-',num2str(block)];
%eval(['load ',SaveDir,'-BlockInfo','.mat numEpochs -mat']);
% For when resample to proper 256
f1=2.569901428222656e+002;
f2=256;%destination sampling rate
num_chunks=4;
tail_length=0; %defaults to 20,000
visualize=0;
maxep=21600;
% passbanddelta1=0.5;
% passbanddelta2=100;
% stopbanddelta1=0.45;
% stopbanddelta2=110;
epochl=4;
maxbin=120*epochl+1; %FFT goes out to 120 Hz (because otherwise psd goes to arbitrary frequency (nyquist)
f=0:1/epochl:120; %f is saved with Spectrafull
for j=1:length(EEGChans)
chan=EEGChans(j);
sig_EEG=ReadContinuousData_AVR(tank,block,'EEGs',chan);
EEGdata256=resampling(sig_EEG,f1,f2,num_chunks,tail_length,visualize);
numEpochs=floor(size(EEGdata256,2)/(f2*epochl));
numEpochs=min(numEpochs,maxep);
if length(EEGdata256) < numEpochs*epochl*f2 %pad EEGdata256 with zeros if has less data points than it should (shouldn't happen)
EEGdata256 = [EEGdata256 zeros(1,(numEpochs*epochl*f2)-length(EEGdata256))];
fprintf('DATA WARNING');
end
EEGdata256=EEGdata256(1:(numEpochs*epochl*f2)); %Cuts off extra data, uses numEpochs as law of how long it should be
sig1=reshape(EEGdata256,f2*epochl,numEpochs);
spectr=zeros(maxbin,numEpochs); %Rows: frequencies, Columns: epochs
fprintf(['Running PWELCH for EEG ',num2str(chan),'\n']);
for ep=1:numEpochs
%This is big processing step. spectr is created by pwelch
EEG = sig1(:,ep);
Pxx=pwelch(EEG,hanning(epochl*f2),[],epochl*f2,f2);
spectr(:,ep)=Pxx(1:maxbin);
end;
clear sig1;
eval(['save ', SaveDir,'-EEGch',num2str(chan),'-SpectraComplete.mat f spectr EEGdata256 -mat']);
clear spectr EEGdata256;
fprintf(['SpectraComplete created for EEG channel ',num2str(chan),'\n']);
end
fprintf(['EEG files created for ',tank,' block: ',num2str(block),'\n']);
end
The error I'm getting is Undefined function or method 'ReadContinuousData_AVR' for input arguments of type 'double

Answers (0)

Categories

Asked:

on 13 Oct 2014

Community Treasure Hunt

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

Start Hunting!