LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error while saving some default value in excel file

Hi,

I have been trying to accomplish a very simple task. I am trying to save values used in “PARAMETERS DESCRIBING PATH” of  "Photo_Diode_N_Motors_DAQ" and want to reload the same values in “PD_Display_From_Spreadsheet”. There is a function named “Display to Motor” in “PD_Display_From_Spreadsheet” which will use four of those values namely y_intial, y_step_size, z_intial, z_step_size. Needless to say that I am not able to do successfully. Each time I am trying to run, I am getting following error:

 

“Error 1 occurred.

 

Possible reason(s):

 

LabVIEW:  An input parameter is invalid.

---

NI-488:  Command requires GPIB Controller to be Controller in Charge.”

 

However, if I remove the part where I am saving those values, it works fine.

 

  You may like to have look at frame 1 of "Photo_Diode_N_Motors_DAQ" as well as use of “Display to Motor” in “PD_Display_From_Spreadsheet”.

 

Thanks,

Dushyant

0 Kudos
Message 1 of 9
(3,411 Views)
Hello,
 
You don't seem to be having GPIB problems, so my guess is that your issue lies in specifying a file path, which I see done in your Photo_Diode_N_Motors_DAQ.vi. The best thing to do is to run the VI on your machine after putting a probe and a breakpiont on the path entering the "Write to Spreadsheet File.vi" in order to verify the path of the file that you are trying to write.  A very common cause of Error 1 is ill-specifying a path to a file writing VI!
 
I think you'll find your issue there; if not repost and we'll have another look!
 
Thank you,
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 2 of 9
(3,400 Views)
Hi,
 
I believe that couple of subvis are missing. If u r trying to have a look at my code, please do not worry about missing subvis. Also, Photo_Diode_N_Motors_DAQ is the code that you may want to look at. You may look at stacked sequence no 1. It also does not make any difference whether I change the order of the sequence.
 
I investigated the problem and it seems that it is because of the way I am changing the path to string and then add extra string and then again convert resultant string to a new file path. If I add new file path and do not do "conversion stuffs", it works fine.
 
However, I need this features so that I can keep the track of "motion paramters" (six paramters that I am saving) and the corresponding photo diode image.
 
So, the question is:
 
How to use an already used filename, add a string and generate a new filename?
 
Thanks,
DK
0 Kudos
Message 3 of 9
(3,396 Views)

Hello,

Ok, so indeed it was the file path/naming that caused Error 1.  So, it sounds like you want to take something like:

C:\MyDir\MyFileName.txt

and create something like:

C:\MyDir\MyFileName_new.txt

Perhaps the easiest way is to use the Strip Path function from the File I/O palette.  It takes a path input, such as C:\MyDir\MyFileName.txt, and produces two outputs: C:\MyDir as a path and MyFileName.txt as a string.  With that string output you can use the string functions (such as size, string subset, search string, match pattern, etc.) to take just the part you want.  In this example, you would take just MyFileName and concatenate _new.txt to form your new file name MyFileName_new.txt.  Now, you can use the Build Path function, with your stripped path output of C:\MyDir and your new string file name MyFileName_new.txt to build the path C:\MyDir\MyFileName_new.txt. 

I think that's what you want to do!  For general reference, if you would like to query for a file name, you can use the List Directory function found in the Advanced File Functions palette - it returns the folders (directories) and file names at a given path.  Using the functions noted above you could then build an arbitrary path.  Also note that you can always go between path and string data types in LabVIEW as necessary with the Path to String and String to Path functions (also found in the Advanced File Functions palette).

I hope this gives you exactly what you need!

Best Regards,

JLS

Best,
JLS
Sixclear
0 Kudos
Message 4 of 9
(3,392 Views)
PS - I didn't mention that the build and strip path functions are in the File I/O palette, so I wanted to here just for completion :)
Best,
JLS
Sixclear
0 Kudos
Message 5 of 9
(3,391 Views)

Thanks JLS.

I did as you suggested and it worked mostly. However, there is only a small issue still not solved.

I am using "path control" from "string and path" of control palette.  If I am providing file-path prior to running code, it works fine.

If I am not providing file-path prior to running code, it gives me pop-up dialog. In this particular case, it does not generate a new file name and the same pop-up window appears twice. Please let me know if you ave any suggestion for this.

Thanks again for getting me out of trouble,
 
Dushyant

Message Edited by Dushyant on 09-30-2005 01:28 PM

0 Kudos
Message 6 of 9
(3,385 Views)
Hello,
 
Can you post the popup you're referring to just for clarity.  My guess is that you are seeing a popup for an incorrect path specified or to navigate to a path.  The first case was the original problem, and the second case you can make sure happens if you'd like.  That is, if you'd like to prompt the user to choose a file when you run the program, you can use the File Dialog function in the Advanced File Functions palette.  Is that what you're looking for?
 
Let me know, it sounds like we'll have this one hashed out soon!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 7 of 9
(3,379 Views)
Thanks JLS!!

I was able to sort out the problem.

I am writing out the detail just incase  somebody  has similar problem. Pease open the attached code and open the block diagram. I have denoted three positions as "1", "2" and "3". If  "1"

and "3" are connected, the dialog box will appear twice (even if user is expecting only once). However, if   "2" and "3" are connected, it works fine.

 thanks again, JLS!! I really appreciated your help. You may not realize (being Labview Guru) that you have cured one of my big headache.

Dushyant Kumar

0 Kudos
Message 8 of 9
(3,376 Views)
Hello,
 
No problem about the help, I am glad to have helping you get rid of the problem! I think I see the dialog your are referring to now.  Is it the one that asks the user to replace the file?  If so, this is because when the file already exists, the default behavior of the File Open/Create/Replace funtion (used inside the Write to Spreadsheet File.vi) is to show "advisory dialogs."  You can turn those off though, if you'd like, by wiring the boolean input within the Write to Spreadsheet File.vi.  I have attached a version of that Write to Spreadsheet File with Advisory Selection.vi called, and used it in a new version of the test VI you sent.  Together, they give the behavior of writting a file you choose (say MyFile.txt) with the front panel control, as well as a file named with _new appended to it (say MyFile_new.txt).  By exposing the underlying advosory boolean, we can supress or expose such dialogs in all instances you wish.
 
Was that the dialog problem?  Try the VIs attached in the zip file!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 9 of 9
(3,366 Views)