rasmusvt Posted July 4, 2014 Report Share Posted July 4, 2014 Hey! I am pretty new to LabVIEW, and have just encountered a problem I am looking for a simple solution to. I am collecting samples from two channels on a NI-DAQ-Device. The DAQmx Read-VI outputs a 2D array, where each row represents one channel. I want to write this data to a file in the following format: sample 1 from ch1; sample 1 from ch2 sample 2 from ch1; sample 2 from ch2 etc; etc Is there an easy way to do this? Thanks! Quote Link to comment
crossrulz Posted July 4, 2014 Report Share Posted July 4, 2014 You could use the Write To Spreadsheet File. You may have to play with the Transpose? input. Personally, I just use the Configure Streaming function to stream the data to a TDMS file. I makes things really simple. Quote Link to comment
rasmusvt Posted July 7, 2014 Author Report Share Posted July 7, 2014 Thank you,this achieved exactly what I was looking for! Quote Link to comment
ThomasGutzler Posted July 9, 2014 Report Share Posted July 9, 2014 (edited) You could use the Write To Spreadsheet File. Just be careful with this vi, because it doesn't have an error out. If you're passing it an invalid file path or it can't write to the file for some reason, it will pop up an error message blocking everything else, unless you've got automatic error handling disabled, in which case you will never know that things go wrong until you can't find the files. This is why I sometimes prefer to use a combination of "Array to Spreadsheet String" and "Write to Text File", which allows you to handle the errors. Edited July 9, 2014 by ThomasGutzler Quote Link to comment
hooovahh Posted July 9, 2014 Report Share Posted July 9, 2014 Just be careful with this vi, because it doesn't have an error out. So whenever I go to use this function for simple programs, I always open the VI copy away the functions it calls (which admittedly aren't much) and paste those into my VI instead of calling that VI directly for that reason. Wouldn't it suck if all VIs on the palette didn't return an error but instead had a simple error handler in each of them? Then why do that for this function? Quote Link to comment
Yair Posted July 9, 2014 Report Share Posted July 9, 2014 Just be careful with this vi, because it doesn't have an error out. http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Revision-of-many-VIs-written-by-NI-usage-of-the-error-cluster/idi-p/2028642 Quote Link to comment
Phillip Brooks Posted July 10, 2014 Report Share Posted July 10, 2014 Just be careful with this vi, because it doesn't have an error out. If you're passing it an invalid file path or it can't write to the file for some reason, it will pop up an error message blocking everything else, unless you've got automatic error handling disabled, in which case you will never know that things go wrong until you can't find the files. This is why I sometimes prefer to use a combination of "Array to Spreadsheet String" and "Write to Text File", which allows you to handle the errors. The Robust CSV package from the Code Repository includes error handling and can handle strings containing commas and cr/lf http://lavag.org/files/file/239-robust-csv/ Finally, something that can manage crlf ! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.