In an example(attached), the DAQmx create task funtion is connected with DAQmx create virtual channel function, but no task was created in the DAQmx create task function because no virtual channel is selected. Rather a task or line is created in the DAQmx create virtual channel function.
What's the purpose of using DAQmx create task, to me it seems useless here.
It seems both function can create task, what will happened if selected a different line in the DAQmx createtask function, say line 2 in this case?
The DAQmx Create Virtual Channel adds a channel to a task. If a task does not exist, it creates one.
The DAQmx Create Task is useful when you want to add many channels to the task. The main situation I have ran into is when I'm creating a data logger with many AI channels. I have the settings for the AI channels in an array and then I can just use a FOR loop to add each desired channel to the task. The DAQmx Create Task is needed in order to iniitalize the task and pass the task into the shift register on the FOR loop as the channels are added.