LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Won'r Create File Before While Loop

Solved!
Go to solution

I have a .vi that is collecting analog signals inside a while loop. I am using the producer/consumer (data) template to write the analog data to a file. I am using the Open/Create/Replace file function to open a file then write to it then close it. I currently have the open/create/replace function outside the while loop, the write to file inside the while loop, and the close file outside the while loop.

 

Here is my issue: when I run the program there is no dialog box to select the file path. It immediately gives error 43 (on and indicator) which says I cancelled the dialogue box. I didn't even see a dialog box. I have no input to the "file path" input to the create file function. It's almost like the dialog box opens and closes before I even see it. How can I fix this? 

 

I cannot upload or download my .vi right now but any help is greatly appreciated!

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

Is this running on an RT system?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 12
(3,044 Views)

No it is not.

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

@MikeIsMyName wrote:

 

I cannot upload or download my .vi right now but any help is greatly appreciated!


  • What are the exact values of all inputs wired to the file open function?
  • Does it work any differently if you open inside the while loop or is that part of your post irrelevant?
  • What happens if you use an explicit file dialog before opening the file?
0 Kudos
Message 4 of 12
(3,015 Views)

The file is attached. It shows the producer/consumer loop and the create file function leading to the consumer loop. When the program is ran it just simply starts streaming the data to the charts on the front panel without asking where to create the file. The error code is 43 saying the user closed the dialog box even though it never shows up. 

0 Kudos
Message 5 of 12
(2,990 Views)

Hi Mike,

The dialog popped up for me ok.

 

Also, this is the same problem of writing to a file from your other thread, please keep all discussion in the same place so we don't duplicate each other's efforts to answer your question.

 

https://forums.ni.com/t5/LabVIEW/Exporting-Data-to-Excel-From-While-Loop/m-p/3809205#M1075638

0 Kudos
Message 6 of 12
(2,985 Views)

What would be the reason for it to pop up for you but not for me? Is it where I saved the .vi or the project to? Should I save it to a different folder? I also run labview as administrator everytime. Hmmmm.

0 Kudos
Message 7 of 12
(2,972 Views)

Without the sub vi I can merely guess what may be happening. (Oh, but my 8-Ball is magical!)

 

You probably get a default value out of Refresh rate that is zero.  (That combo box shou;ld be a ring!)

 

This leaves the top loop greedy and the ui thread swamped by the chart refreshes and the plot color property nodes (Consider using a value change event to set the plot colors in a separate loop)

 

So there is really no time to toss up the dialog box that needs an idle ui thread to pop-up.  When you press stop The other stop or get an error you immediately destroy the queue signaling the logging loop is ready to exit.  Then the dialog box should appear... unless you hit the abort button to stop the vi (quit doing that!)

 

Also, Time stamps are incremented by seconds so to convert to excel time you multiply by 86400 sec / day and then add the number days between dec 31 1899 and  Jan 1 1904 (1461) and then add 1 more for the bug in Excel that forgot 1900 was not a leap year.


"Should be" isn't "Is" -Jay
Message 8 of 12
(2,952 Views)

@JÞB wrote:

Also, Time stamps are incremented by seconds so to convert to excel time you multiply by 86400 sec / day and then add the number days between dec 31 1899 and  Jan 1 1904 (1461) and then add 1 more for the bug in Excel that forgot 1900 was not a leap year.


I think you also need to add or subtract the number of seconds based on your timezone offset.  So for EST (UTC -5), you'd have to account for 5 hours worth of seconds (5x3600) since LabVIEW times are based on UTC and Excel bases them on your current timezone.

Message 9 of 12
(2,942 Views)

You guys have been extremely helpful and I appreciate that! I believe I found the issue but the fix is still eluding me. Here it is:

 

The 5 analog signals coming in are coming from a myRIO. I believe the .vi I have written is trying to create the file to the myRIO instead of to my computer. Now, for a producer/consumer structure, can I create the consumer loop in a seperate vi that will know to save to computer? I would place this vi under the "My Computer" cluster in the project viewer  instead of the vi that is on the myRIO. Is this possible? Can I run the queue between two vi's?

0 Kudos
Message 10 of 12
(2,927 Views)