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.