09-28-2005 02:27 PM
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
09-29-2005 06:23 PM
09-29-2005 06:52 PM
09-29-2005 07:59 PM
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
09-29-2005 08:00 PM
09-30-2005 01:27 PM - edited 09-30-2005 01:27 PM
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.
Message Edited by Dushyant on 09-30-2005 01:28 PM
09-30-2005 01:34 PM
09-30-2005 06:58 PM
10-03-2005 12:07 PM