05-28-2013 08:28 AM
Hello everyone! I have a task to implement some of the advanced I/O techniques in my code, so I decided to make a reading/writing subVI with TDMS. The data I need to write in is a number, type of double. The problem is that TDMS accepts type of waveform, and when I convert my number to data type,which TDMS accepts, it doesn't write my data into file.It only writes the time of execution and other irrelevant data. Is there any possibility to write a data of double type?
Solved! Go to Solution.
05-28-2013 09:51 AM
If you look at the help for TDMS write you will see that numeric data needs to be in a 1D or 2D array.
05-28-2013 10:51 AM
Are you trying to write a single value to a channel? TDMS is setup to stream data to the disk. This means it wants many data points to write at a time. If you are only writing a single value to a channel, you should write the value to a property instead.
05-28-2013 12:01 PM
I need to write a single data,yes. I used a conversion "double to data", but TDMS didn't write it. It's not 1-D array, but 1-D waveform array, and a type mismatch is indicated.
05-28-2013 12:29 PM
Can you post your code? I'd just be shooting in the dark without it.
05-28-2013 12:38 PM - edited 05-28-2013 12:39 PM
@miki90 wrote:
I need to write a single data,yes. I used a conversion "double to data", but TDMS didn't write it. It's not 1-D array, but 1-D waveform array, and a type mismatch is indicated.
Just try to wire a 1D array of Double to the write terminal. The terminal is polymorphic and will change to the data type you wire to it, but the default is a 1D array of waveform. If you only one have one element you want to write (not an array) then use the build array to turn your scalar double into an array of double with just one value.
TDMS works best when you are writing a chunk of data at once. So a better option is to collect a bunch of these scalar values builing the array your self then writing them all at once. Writing one element all the time in a loop can cause very large index files, and performing a close and defrag will fix this, but the better solution is to write more than one element at a time.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-28-2013 12:47 PM
TDMS is in Read/Write subVI on the right.
05-28-2013 12:51 PM - edited 05-28-2013 12:55 PM
@miki90 wrote:
TDMS is in Read/Write subVI on the right.
There is alot of scary going on there.
You take a scalar value, then insert it into a blank array, then convert it to Dynamic Data type then try to wire that into a sub VI that has a 1D array of waveform, then you build an array (making it a 2D array of waveform) then try to write that...just write the single scalar double to TDMS by using a build array (making it a 1D array of double).
Holy Cow. Few other things (sorry if I come across as judgemental just trying to help)
You obviously are running this VI after setting some values and that's not how programs work (or should work) When I open Excel I don't have to click the Run button first. You run the program then change the controls as it's running.
You are looking to figure out which button was pressed, if your VI was running you could just have an event structure that tells you what was pressed.
You also have no groups or channel names in the TDMS write. Doesn't this generate an error every time?
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-28-2013 12:52 PM
Hooovahh, it cannot accept an array of double, I tried it. It only accepts a waveform 1D array.
05-28-2013 12:57 PM
@miki90 wrote:
Hooovahh, it cannot accept an array of double, I tried it. It only accepts a waveform 1D array.
The "TDMS Write" function accepts a 1D array of double. Your subVI that has the write in it, doesn't. Change the subVI.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord