LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch forever TDMS

Solved!
Go to solution

Hallo everyone,

 

I need help regarding NI example programs: niScope Fetch Forever, Write TDMS & Read TDMS.

When I try to fetch continuously and save the data in TDMS file, its working fine, but when I try to read the data back to Labview (or convert them to .txt or .csv),

I'm having memory problem when I have too big TDMS data to read at once.

Is there any trick to split them first then read them?

The problem is, Read TDMS.vi doesnt know automatically how big the data being stored in .tdms file which being read.

I think I need to use FOR loop and offset and count as control in TDMS read block, then convert them into csv. or .txt using index number for the created files.

Example of what I'm trying to achieve; I'm having 20,5millions datas in an array in example.tdms, then I would like to have 6 files with 3 millions datas, and 1 file with 2,5 millions datas, which means I need to split them.

 

The other problem is, I'm trying here to get total points fetched2 to be O when I start the program, then increase when I hold the save button. In this program, I dont get it back to O when I keep my SAVE button TRUE all the time.

 

Please, any help would be really appreciated.

 

regards,

Yan.

 

Save.png

Download All
0 Kudos
Message 1 of 7
(4,755 Views)

I would use a while loop, read n samples every time.

If the number of read samples is smaller than n, then I quit the while loop.

Here's a small example:

ReadTDMSSteps.png

 

Ton 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 7
(4,747 Views)

You can use "NI_ChannelLength" to get the number of values in a channel.

0 Kudos
Message 3 of 7
(4,735 Views)

@TCPlomp

thanks ton, thats a simple but nice idea from you. Do you think I can create .txt or .csv file at the same time without having memory problem?

It would seem that creating multiple files at once wouldn't be problematic? (*haven't tried myself)

 

@deppSu

thanks for replying, but can you more spesific directing me, I don't know where to find "NI_ChannelLength".

 

regards,

Yan.

0 Kudos
Message 4 of 7
(4,723 Views)

@TCPlomp

hi ton, seems your method somehow doesn't work on me. It keeps saying: "End of File found".

Seems like I couldn't split the data being read using your method on me.

 

regards,

Yan.

 

eof.png

0 Kudos
Message 5 of 7
(4,714 Views)

hi everyone,

 

I've just found something useful while browsing example codes in this forum.

I've found this example and I think it's pretty much like what I need (https://decibel.ni.com/content/docs/DOC-8985).

But still, using this example still gives me the same error code "EOF found". Smiley Frustrated

I don't know where is my problem, maybe the way I'm writing data into my TDMS file in Fetch Forever.vi?

Or maybe the TDMS file which I build here is not ok to read?

 

regards,

Yan.

0 Kudos
Message 6 of 7
(4,711 Views)
Solution
Accepted by topic author Mystogan

OMG nevermind,

 

I just forgot to put the same name that I used in write TDMS.vi (Groupname&Channelname) into my read TDMS.vi. Smiley LOL

 

So, I think the solution is that example code (https://decibel.ni.com/content/docs/DOC-8985) combined with a little more careful analysis.

 

Thank you very much,


regards,

Yan.

0 Kudos
Message 7 of 7
(4,708 Views)