From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write at a certain position of the channel

Hi all,

 

I am trying to write 2D arrays in tdms database.

I need to put each array at a certain channel and in a certain position.

In fact each 2D array is the data from an image which should be stored at a certain point.

 

I tried using "TDMS Set Next Write Position" but it is giving some strange output.

Does anybody know how to write at the end of a specific channel?

 

here is short VI as a sample of what I tested. I expect the data to be written in channels im3 and im4 (since the data a 2*4)!

Further on I have to put the next array in channels im1 and im2. and so on..

 

Any help would be greatly appreciated.

 

Thanks

Arash

0 Kudos
Message 1 of 12
(3,585 Views)

Hello Arash,


The vi you attached was a great help to understand what you want to do and what doesn't work, thanks for this.

 

For now, I'm not sure why your program doesn't work proberly. Something seems to go wrong at the step when you write, the shape of your array changes.

I will go on investigating and let you know when I have new information.

Kind Regards,
Julia


0 Kudos
Message 2 of 12
(3,530 Views)

Hello Arash,

The array you want to write into the file has two columns, but channel im3 has only one column.
How do you want the array to be in the TDMS-file? Channel im3 with two chlumns (as the array), Channel im3 and im4 are together as the array or some other kind?

Kind Regards,
Julia

0 Kudos
Message 3 of 12
(3,516 Views)

Hi Julia,

 

Thanks for your replies.

 

I thought it is not possible to write a 2D array in just one channel, so i believe this will be written in channel im3 and im4 together.

 

Basically what I am acquiring images from a camera, and I need to stitch the images to form a bigger image. since the memory grows to big then i want to write them in a tdms file so that i can use it in a post processing.

so i need to write each image (2D array) in a certain position of the tdms file, so that later i can read one group (which consists of different single images) as my stitched big image. Otherwise i need to use a for loop which goes through different channels and reshapes them, which will be time taking.

 

I believe this should be possible in tdms, but I have no idea how to do it Smiley Wink

 

Best,

Arash

0 Kudos
Message 4 of 12
(3,504 Views)

Hi Arash,

obviously it's not possible to write a 2D array into a TDMS file so that it stays this array, LabVIEW changes the array so that it has only one column and can be written in one channel.

I tried to write an array of just one column in a certain channel, thinking if this works you can use loops. It didn't work, the data were written in channel im1 instead im3. I attached this example. I will go on trying and let you know if I find out something new.

Kind Regards,
Julia

0 Kudos
Message 5 of 12
(3,458 Views)

Hi Julia,

 

Unfortuantely since I am using Labview 2013, I could not open the VI that you attached.

But just as you said, I have also tried writing a 1D array and it goes to im1 !!

 

Thanks again for your help. I would be glad to hear it if you come up with somthing new 😉

 

Best,

Arash

0 Kudos
Message 6 of 12
(3,441 Views)

Hi Arash,

 

How do you want to open the bigger image that you create in LabVIEW?
Is there a special reason why you use the advanced functions?

Best,

Julia

0 Kudos
Message 7 of 12
(3,411 Views)

Hey Julia,

 

I'm not going to open the images in Labview, but I will just save them on the hard drive.

which advanced functions do you mean?

I would like to find a work around whcih is not occupying all the RAM..

 

Thanks,

Arash

0 Kudos
Message 8 of 12
(3,401 Views)

Hi Arash,

 

you use asynchronous functions, and these are advanced, not the "standard" functions. Is there a special reason why you use them?

Have you tried to modify the "TDMS Advanced Overwrite"-VI from the Example Finder? At this Example, LabVIEW seems to write the data at the right position.

 

Best,

Julia

0 Kudos
Message 9 of 12
(3,394 Views)

Hi Julia,

For your confusion, I find that if the file doesn't contains raw data, "TDMS Set Next Write Position" is invalid. An empty file will always write from the first channel because it cannot set the file pointer to a position that doesn't have data.

Besides, if you want to overwrite a tdms file, you shouldn't use "TDMS Set Channel Info" again. It should only be used to initialize an empty file. If you set channel info again, "TDMS Set Next Write Position" cannot locate the right position. 

I modified your attachment for detailed explanation.

Best Regards,

Xiaowei

0 Kudos
Message 10 of 12
(3,360 Views)