First argument provided is not valid for addlistener
Show older comments
I'm trying to pipe some data from and acquisition device to a function. The function is stored in separate file and is added to the working directory earlier in the code so Matlab finds the function ok but I get the error report below any ideas? (section of code added, Channel in use is AI)
Regards Stu
??? First argument provided is not valid for addlistener. (Check its type or validity)
__________________________________________________________________________
n_ch=1; % the number of channels in use
% Preparing and setting uo the DAQ card (NI USB-6210)
AI=analoginput('nidaq','Dev1');
% set to single ended, Fs and durationid1
set(AI,'InputType','SingleEnded')
chan=addchannel(AI,0:(n_ch-1)); % create number of channels
SampleRate = 2000; % used as frequency content exceeds 500hz
cd C:\Users\Ghost\Desktop\MATLab\
addpath(' C:\Users\Ghost\Desktop\MATLab\Codes')
addpath(' C:\Users\Ghost\Desktop\MATLab\Functions')
% set Fs and durarion
set(AI,'SampleRate',SampleRate);
set(AI,'SamplesPerTrigger',inf);
set(AI,'TriggerType','Manual');
set(AI,'TriggerRepeat',0);
type('.\Functions\emg_processing.m')
addlistener(AI,'DataAvailable', @emg_processing);
__________________________________________________________________________
function emg_processing(src, event, newdata)
end
Answers (0)
Categories
Find more on National Instruments Frame Grabbers 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!