I think the built-in example for Thermocouple - Continuous Input.vi (DAQmx) will do almost everything you want.
You can find it by:
Add the following code:
Here's an image showing those modifications:
Ive got two input channels and I'm just getting the readings of one, and the readings r pretty much incorrect.
I'm just getting one set of readings while I'm supposed to get two sets for the two channels.
Zaqf, please provide more information when you respond. For example:
Sorry. The readings r correct but since there r two channels , readings for one channel is missing. And still I'm not able to save the data
Guess you're still not a fan of DAQmx. In your While loop, you're using the Convert from DDT to Scalar that was suggested for a single channel. You have multiple channels, so you need an array of values to be outputted there. Double clicking on it should allow you to change it to 1D array of scalars.
For Newmod123, click on the From DDT function. Change it from Scalar to 1-D array of scalars automatic, For the Build array inside the loop, right click on it and pick "Concatenate Inputs".
For the DAQmx code, that is a mess right now as you go from a 2-D to a 3-D to a 4-D array. Don't throw down a Build Array function without knowing why you are doing it.
To fix the DAQmx code, and make it behave like your original DAQ Assistant code does,
1. Change the DAQmx Read to N channels, 1 sample.
2. Put in your time column stuff you have in the DAQ Assistant code, but left out of here.
3. Go a Build Array with Concatenate between the time and the DAQmx Read's 1-D array.
4. Feed that into the 1-D array input of the Write to Spreadsheet function.
5. Get rid of the lonely Build Array that you have in there now.
Better yet, use Build Array and a shift register with the array indicator inside the loop and you can see the table grow as the code runs.
It is a VI snippet. Save the PNG to your desktop. Then drag the png file to your block diagram.
It also isn't that much different than what you have now, so you ought to be able to modify your own code to match.