02-26-2018 03:50 AM
The basic logic in my mind is to read one tdms file with multiple (30) groups and save/write it as another tdms file with single group but this one and only group should contains all the samples in those 30 groups. With these dataflow steps in my mind, i developed last read and write tdms code in a while loop using VIs other than express VIs. But still , the code is not working, although i tried the code you modified in last post. While debugging the code, it is giving ERROR 4. I tried to search on forums about this error. The solution mentioned in some posts i-e creating a shift register and wiring End of file of "read TDMS" VI to reset is already done in this code. code gives the error as shown in figure below. Error shown after running the code attached
i also tried by inserting element number equal to 29(as groups are from 0 to 29). The code is same as corrected by you last time.
The issue is not that i cannot understand the logical flow of my problem. The issue is that i cannot figure out the right VIs in NI lab view which can resolve my issue.
Is there some mistake in code?
Or the choice of TDMS files. As after i run the code the file whose path was given for"TDMS read" simply vanishes from its location. But the TDMS file whose path i used to give as "write TDMS"VI, reduces its size from 1200 KB to 1 KB and no groups inside the TDMS file. Hence no data is written.
I have attached both files , the one i used for TDMS read and the other i used for TDMS write, named as same as mentioned.
What could be the issue with code or files i am using now?And how can it be resolved?
02-26-2018 05:47 AM - edited 02-26-2018 05:49 AM
Hi irsa,
next fault of your own:
As after i run the code the file whose path was given for"TDMS read" simply vanishes from its location.
Because YOU have chosen the mode "create or replace" when opening this TDMS file!
Why did you do this???
Which kind of data was written to the TDMS file? After adding TDMSViewer two times this is easily answered:
Here I implemented the reading of single signal "Voltage_0". The resulting TDMS file contains just one group with just that signal.
See how far you get to read all voltage signals from your source data file…
02-26-2018 09:49 PM
The code shown below is now perfect to create 1 group with 1 channel in the written TDMS file.But when it writes the data it only takes x-axis data of each group for voltage_0(1 channel). The repetition of data can be clearly seen in below TDMS written file( It is first group 's y-axis data copied 30 times throughout the data).
I have also limited the number of elements in loop by 30. The results are same without this thing.
How to copy y-axis data correctly in the tdms written file in correspondence to its x-axis part?
02-27-2018 01:47 AM
With reference to my last post, it seems that the code above reads and writes only group 1 out of total 30 groups. How to make it read all the 30 groups and writing it in 1 group such that each channel should have 30 groups data without loosing any data?
02-27-2018 02:47 AM - edited 02-27-2018 02:50 AM
Hi irsa,
How to make it read all the 30 groups and writing it in 1 group such that each channel should have 30 groups data without loosing any data?
It's again YOUR FAULT!
In contrast to my snippet you decided to read the group named "untitled" in each iteration of the loop - now you wonder why this one group is read again and again? The code does exactly what YOU have programmed it to do!
(There's a reason why I put this TDMSViewer two times into the snippet - here I use it as debugging tool!)
Either change the group name with each iteration or remove this input as in my snippet!
02-27-2018 04:15 AM
Here's a cartoony picture that might help.
As Gerd has mentioned, the TDMS Read function will read the data you tell it to! 🙂
If you connect "group name in" and "channel name(s) in" it will read the group and channels you tell it to - if you do not, it will "read data from the current group in the file. The current group is either the first group in the file when you run this function for the first time or the nth group at the nth cycle when you run this function continuously for multiple cycles." (taken from the Detailed Help, and I learn something new - I never previously knew this).
Consequently, you must either not connect those inputs (in which case it will take all channels from each group in turn) or you must connect the correct inputs (which might not be the same every time (hint hint)).
When you write, the behaviour is slightly different. Defaults can be generated (Untitled for Group, and depending on the data layout for the Channels, but likely "Untitled", "Untitled1", ...), but there's no cycling (fortunately). As a result, it should be easier to get the correct inputs for what you want here.
02-27-2018 08:26 PM - edited 02-27-2018 08:29 PM
Thank you so much @GerdW due to your help and effort we completed this task also learnt it doing in LV 🙂
02-27-2018 08:27 PM - edited 02-27-2018 08:30 PM
Thanks for the explanation:) @cbutcher