06-10-2015 02:19 PM
I tried the little snippet you posted following my suggestion that you "experiment" with getting the Write to Spreadsheet function to work. Oops, your code threw an error (possibly because you never finished it). At the risk of stifling your initiative, try this;
You'll notice I added a "Proof of Concept" three-function "Read it back and prove to me the data are there" as an Extra Credit Exercise. If you can get your code to generate data as a 1 or 2D array of reals, this pretty trivial code will write it.
BS
06-10-2015 02:52 PM
Thank you Bob. I have been "playing" with it for quite some time. I am able to put the for loops together and write to my spread sheet. My problem is writing from the DAQmx Read (data terminal), to the write to spreadsheet. I attached a screenshot of what I have been playing with.
06-10-2015 02:58 PM
The "," was supposed to be attached to the delimiter on the Write to spreadsheet. Not sure how I moved that during screenshot.
06-10-2015 03:02 PM - edited 06-10-2015 03:03 PM
1 channel 1 sample puts out a scalar value. Hover over the broken wire and it will tell you error, that the source is a scalar, and the sink is either a 1-D array of double or a 2-D array of double (depending on if you use the 1-D or 2-D array input.)
Just use build array to turn the scalar into a 1-D array and wire it into the 1-D array input.
Be sure to wire a True constant to the Append? input of the Write to Spreadsheet file, otherwise your single value will constantly overwrite itself.
06-10-2015 03:04 PM
Now that we can see your code, it becomes A LOT easier to spot the issue. Your problem is that you are reading a single data point from the DAQ. Therefore, the DAQmx Read outputs a SCALER. The scaler is not compatible with an array. Luckily, the solution is really simple. Build an array. You can do this with a FOR loop and autoindex the output (allowing you to write more samples at once, reducing the time it takes to write the data) or you can just use Build Array reduced to a single input. This will turn your scaler into an array with a single element.
06-10-2015 03:07 PM
Thanks a lot guys, that did it. I can't believe I spent all that time yesterday and today and couldn't figure this out.