MATLAB_DAQmx_examples icon indicating copy to clipboard operation
MATLAB_DAQmx_examples copied to clipboard

helper function for clearing existing task of a defined name

Open raacampbell opened this issue 6 years ago • 0 comments
trafficstars

Because of the annoying errors where an existing task of the same name exists following an error:



    % Check if free

    taskMap = dabs.ni.daqmx.Task.getTaskMap;

    if any(strcmp(taskMap.keys, obj.taskName))

        oldTask = taskMap(obj.taskName);

        disp(['Deleting existing task "' obj.taskName '"']);

        delete(oldTask);

    end

Check that fixes our problem. If so, write a function that wraps task creation so all functions use it and we avoid this annoying problem.

raacampbell avatar Nov 18 '19 17:11 raacampbell