Save CSV wave to created directory
esmaras
I am trying to create a new folder within my Igor Experiment folder to save CSV files created from waves of data that I have. For some reason, when I execute these four lines of code, the program does not save on the last line. Instead, I get the error that the path name does not exist. How is this possible when I am specifically creating the directory that I will be using? I stepped through the code and ensured that the folders were in fact created.
String location = "C:\\Users\\John Hayward\\Documents\\"
String newCSVFolder = "2450 Trace_USB_SINGLE\\Data\\"
NewPath/C/O monthFolder, location + newCSVFolder + "January2014"
Save/J/P=monthFolder CSV as fileName
July 11, 2014 at 07:06 am - Permalink
DisplayHelpTopic "Symbolic Paths"
You can omit the /P and use a full path instead. Most Igor operations that work on files accept any of the following:
July 11, 2014 at 08:18 am - Permalink
July 11, 2014 at 08:54 am - Permalink
My mistake. You are using a symbolic path name.
For debugging purposes I recommend that you create a test function as follows:
String fileName
String location = "C:\\Users\\John Hayward\\Documents\\"
String newCSVFolder = "2450 Trace_USB_SINGLE\\Data\\"
String fullFolderPath = location + newCSVFolder + "January2014"
Print fullFolderPath
String fullPath = fullFolderPath + "\\" + fileName
Print fullPath
End
The use of the temporary string variables fullFolderPath and fullPath may provide a clue as to what is wrong with the paths. They also make the code easier to read and debug.
If that does not provide a clue, simplify the paths until you find something that works. That should reveal the cause of the problem.
Here is another test function that may prove useful for debugging:
String fileName
String location = "C:\\Users\\John Hayward\\Documents\\"
String newCSVFolder = "2450 Trace_USB_SINGLE\\Data\\"
String fullFolderPath = location + newCSVFolder + "January2014"
Print fullFolderPath
NewPath/C/O monthFolder, fullFolderPath
GetFileFolderInfo/P=monthFolder
String fullPath = fullFolderPath + "\\" + fileName
Print fullPath
GetFileFolderInfo fullPath
End
July 11, 2014 at 10:02 am - Permalink
July 11, 2014 at 12:28 pm - Permalink