LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuously run and take data without prompting for file path each time or overwriting old data

Solved!
Go to solution

Hello,

 

My VI is a case structure and the picture I have attached is the part that takes data. Each time this part of the VI is running the file dialog prompts me to “choose or enter path or folder” store the data even though I have specified a file path using a path constant. If I remove the file dialog and wire directly to the path constant the prompts stop, but the old data is overwritten by the new one. I need help to get the VI to do one of the following:

 

  1. EITHER automatically store all the data in the same folder without prompting me to choose a path each time (and without overwriting old data each time new one is taken)

 

  1. OR create a new folder each time this part of the VI is running to store the current data
0 Kudos
Message 1 of 15
(4,287 Views)

When I move the file dialog and the path constant out of the loop as in the attached picture, I'm only prompted once to select a folder. But the data old is overwritten each time new one is taken. What I'm I doing wrong? Please I need help.

0 Kudos
Message 2 of 15
(4,277 Views)

I forgot to attach the picture.

0 Kudos
Message 3 of 15
(4,276 Views)

It is easier to help if you attach code as opposed to pictures.

 

What do the other cases of the event structure do? Is the shift register wired through in all cases? Are you perhaps losing the values this way?

 

What do you mean it's overwriting? How many files does it create? 1? 20?

0 Kudos
Message 4 of 15
(4,272 Views)

@Intaris wrote:

It is easier to help if you attach code as opposed to pictures.

 

What do the other cases of the event structure do? Is the shift register wired through in all cases? Are you perhaps losing the values this way?

 

What do you mean it's overwriting? How many files does it create? 1? 20?


Hello,

 

This is the code. Each run create 100 images in the form of text file. By overwriting, I mean the new data replaces the old one which is then lost forever. Thanks.

0 Kudos
Message 5 of 15
(4,265 Views)

Move the image number to the outer most while loop, where the Initialize State constant is. Use a shift register and make sure you wire through all states.

 

What is happen now you take 100 images, then when you take then next 100 images the shift register Image number starts at 0 again because it is in the inner loop.

 

mcduff

0 Kudos
Message 6 of 15
(4,254 Views)

Hi Petmar,

 

It looks to me like you have the right idea with the section of code that generates the file names in your for loop (reattached below).  I think the trouble you might be facing is when you go to the "next position" state, one of the position states, and then back to the "TakeData" state.  I can't run the full code on the machine I have right now but it looks like the same set of file names is going to be generated every time you go back to the "TakeData" state.  If you can come up with a method of adding the camera position to your file name, or something else unique, for each pass through the "TakeData" state I think this will solve your override problem and you can go back to specifying your base path with a constant.

 

-Robert

0 Kudos
Message 7 of 15
(4,250 Views)

@mcduff wrote:

Move the image number to the outer most while loop, where the Initialize State constant is. Use a shift register and make sure you wire through all states.

 

What is happen now you take 100 images, then when you take then next 100 images the shift register Image number starts at 0 again because it is in the inner loop.

 

mcduff


Hello mcduff,

It is still overwriting. I don't know if I did it right.

0 Kudos
Message 8 of 15
(4,243 Views)
Solution
Accepted by petmar

Snap15.pngSnap16.png

 

Is this what you did?

0 Kudos
Message 9 of 15
(4,236 Views)

@rbj wrote:

Hi Petmar,

 

It looks to me like you have the right idea with the section of code that generates the file names in your for loop (reattached below).  I think the trouble you might be facing is when you go to the "next position" state, one of the position states, and then back to the "TakeData" state.  I can't run the full code on the machine I have right now but it looks like the same set of file names is going to be generated every time you go back to the "TakeData" state.  If you can come up with a method of adding the camera position to your file name, or something else unique, for each pass through the "TakeData" state I think this will solve your override problem and you can go back to specifying your base path with a constant.

 

-Robert


Hello Robert,

The camera position is fixed. Its is only the sample that moves and it 5mm intervals. I honestly have no idea of doing what you're suggesting. 

0 Kudos
Message 10 of 15
(4,234 Views)