10-15-2010 03:46 PM
Hello all,
I have a simple VI to open and read a file. I am using "File Dialog Express VI" to obtain the filename from the user, in order to use the "pattern" input to constrain the filetype. Unfortunately, this does not appear to constrain the file list in any way. I attach a picture of my code, and the dialog box produced when it runs, demonstrating that the VI does not in fact limit the file list. Is this a bug? Does anyone know how to fix it? I am running LV 2010 10.0 32 bit on a 2.93 GHz Intel Core i7 iMac with Mac OS X 10.6.4.
Thanks,
Riprock99
Solved! Go to Solution.
10-19-2010 10:58 AM
I would suggest that you use a file path control instead of the express VI. This will offer you more control. Once you place the path control on your front panel right click on it and go to browse options. There you will be able to set your pattern and the name. I have confirmed this on the default installation of LabVIEW. You can see the results in the attached screenshots. Try this and if you are still having issues, confirm that you have the default installation of LabVIEW installed.
Brandon Treece
Applications Engineer
National Instruments
10-25-2010 10:17 AM
Hi Brandon,
Thanks for the suggestion. I have tried it, and have two questions:
1) Can the file path control be executed at run time? When I hit the run button, the file path control gives me an error:
Possible reason(s):LabVIEW: The path is empty or relative. You must use an absolute path.:/Users/anderson/Desktop
I can set it pre-emptively, but my code doesn't work that way. It needs to work with a user selectable file.
2) I set the pattern to *.max (see first figure), but it still shows me all of the files in the directory when I manually select the path by left clicking the folder icon (see second figure). What gives?
Thanks,
Scott
10-26-2010 11:40 AM
You should use the file dialog vi before the open file. This will open a dialog box to search for you file.
I tested this on a Mac OS X and had no issues. You should include a pattern name. See my previous post for the attached images. You will see the pattern name in the dialog box. Hope you find this helpful.
Brandon Treece
Applications Engineer
National Instruments
10-26-2010 12:02 PM
Hi Brandon,
So I potentially will be getting a list of file names, then looping over them, first reading the file, analyzing it, and displaying the result. As such, I am using the file path before I do the open/read, however, my open and read is in a subroutine. Basically, I am handing a filename to a read subroutine. How can I do this without it choking? Here are figures of my example, and my read subroutine. I can post the VI, but I don't have any small data files to send as an example. The first figure shows the main program. I have not yet installed the loop, but I intended to place it around everything but the file path control. The second image is of the actual read routine.
Thanks in advance for your thoughts!
S-
10-26-2010 12:04 PM
Whoops - OK - I see my last post missed the idea of a file dialog vi. However, all I see is the file dialog express vi. Is this what you mean? It has a different icon than the one shown in your post...
Thanks,
S-
10-26-2010 01:53 PM
Hmm - I can't figure this out - still seems like it isnt working
10-26-2010 01:58 PM
To amplify, it appears that LV 2010.0 does not have a file dialog VI (other than the express one, which we have already established has a bug of some sort).
10-26-2010 02:29 PM - edited 10-26-2010 02:34 PM
The pattern constraint works just fine for me in the File Dialog Express VI with LV2010 on WinXP.
My guess is if there is a bug, then it's because you are using a Mac. The screenshots you show of the Mac file dialog box doesn't even show the ability to select different file extensions.
10-26-2010 02:32 PM
Actually, I would argue that there is a bug _because_ of a coding error in LV for the Mac, not _because_ I am using a Mac. 🙂