Currently I can define the required DAQmx physical channels using an Control. Thats very straightforward.
But because several channels have to be selected, I would like the user to select the DAQmx device name, and then append the required channel names in the backend.
How could that be concatenated?
Solved! Go to Solution.
Can you be more specific when you say "How could that be concatenated?" I assume you're not asking how to concatenate strings in general (but let us know if you are). If you're asking how to form a DAQmx Physical Channels constant, then consecutive channels can be defined with a colon, but not consecutive channels must be separated by a comma with a repeat of the device identifier. For example: "Dev1/ai0:3, Dev1/ai7".
If you wanted to make it super easy for yourself, once your user had selected the device and the channels, you could just comma separate every single channel without being smart about the colon syntax. For example: "Dev1/ai0, Dev1/ai1, Dev1/ai2, Dev1/ai3, Dev1/ai7". That's also totally valid. It's annoying to type out manually, but you'd be creating it programmatically.
The more complicated question is probably around what kind of user interface you want to provide so that users can provide the device name and select their channels. I'm not sure exactly what help you're asking for, so it's hard to be prescriptive. Can you elaborate if the above doesn't help?
DAQmx provides two data types, one labeled "PHYS" for physical channel, one for "DEV" for device.
Asked differently, how can I concatenate DEV device and channel suffix to a PHYS physical channel as in the image below.
For *that* part of things, you should change from the Build Array function to Concatenate Strings. The DAQmx Create Channel function will interpret the output string "Dev1/ai1" correctly (though it will show a coercion dot).
However, there's no DAQmx front panel control type that will let you drop-down and find physical a pure physical channel like "/ai1" that doesn't have a leading device designator. You'd need to do something yourself, such as populate a combo box with appropriate channel-only strings to be selected.
You can concatenate I/O terminals just like strings. I personally like Format Into String over Concatenate Strings because it gives you more flexibility and avoids coercion dots. Something like this should get you started:
Even fancier, let users select directly from an array of physical channels constants:
DAQmx already has a built-in function called "DAQmx Flatten Channel String" that does this (minus the type casting to avoid coercion dots):
It all depends on what interface you want to provide the user.