07-19-2017 11:33 AM
Hello,
(customary I'm new-ish to LabVIEW intro paragraph)
I'm working on updating the current program to output a CSV. The original coder exported the data via a TDMS file, and I'd like to preserve this so all I want to do is read from the TDMS to make a CSV. The TDMS is nothing fancy. It's two different tabs (worksheets), and then in each tab, a metric ton of data in about 10 different columns.
I tried working through this forum post in order to do so, but I got stuck. https://forums.ni.com/t5/LabVIEW/Convert-TDMS-to-CSV/td-p/2735395
The largest problem I'm currently having is how to define the data type for the TDMS. Obviously, I need to output the data from the TDMS Read into a 2D array for the CSV Write, but I'm not sure how to tell the TDMS write function how to do so. Even though this won't show much here is a snapshot of what I currently have.
Also, to answer your question, no I can't post my entire code because it's proprietary; however, all that really matters here is that I want to take the data that is in the TDMS after all is said and done, and move it over to a CSV for easy analysis.
I appreciate your help. Thanks much.
07-19-2017 11:55 AM - edited 07-19-2017 11:56 AM
all I want to do is read from the TDMS to make a CSV. The TDMS is nothing fancy. It's two different tabs (worksheets), and then in each tab, a metric ton of data in about 10 different columns.
Well that is easier said than done.
For instance your TDMS file has multiple "sheets" in a "workbook". (Using Excel terms)
A .CSV file is a simple text file with Comma Separated Values. A CSV file can not contain multiple sheets in a workbook like a binary file. (TDMS, XLS, XLSX)
The simplest soultion would be to install the TDM add-in for Excel and use Excel to convert the files as you analyze them
07-19-2017 12:32 PM - edited 07-19-2017 12:53 PM
Ok, good point.
I should have specified, that I don't care if the "sheets" are preserved. If it throws the data into a single "sheet", that's fine.
Can that be done?
07-19-2017 03:20 PM
So I've gotten a little closer to the answer.
Thanks to jeff_scharpf in this post ( http://forums.ni.com/t5/LabVIEW/reading-a-tdms-file-and-saving-it-as-a-csv/m-p/538848 ), I was able to get my first "sheet" (group) of data into the CSV. My question now is how do I access the second "sheet" in order to parse that into the CSV? I was able just to use indices to get the first "sheet", and using the channel names within the other "sheet" returns nothing unfortunately. How does one access the other group of data?
07-20-2017 04:20 PM
If you just want it in a format that is a bit more readable you can use my TDMS to XLSX conversion. It basically calls the NI Addon tool that opens TDMS files in Excel.
http://forums.ni.com/t5/Example-Program-Drafts/TDMS-to-XLSX-Conversion/ta-p/3511652
Other than that I'd say you are on the right track. I would replace all those calls to pull out and bundle waveforms into a single for loop defined to loop 10 times auto indexing the output. Then you have a single 2D array instead of 10 1-D arrays you need to combine.
And if you haven't found them yet here a the links given for free training.
-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)
Learn NI Training Resource Videos
6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord