08-16-2019 09:02 AM
Hi,
In my program, the user is prompted to select a file. The file is then read and a series of searches are performed to be able to select a subarray of the initial data. In the case selector, I'd like to be able to save the new subarray that I just found to a new folder path, but using the same file name that the user selected previously. So if the user selected the file from D:\data\SN1322.txt, I want to save the new subarray as C:\ALEIS\calibrations\SN1322.txt. I cant' figure out how to pass the filename and path that the user selected into my case structure to be able to accomplish this.
Solved! Go to Solution.
08-16-2019 11:05 AM
After you're done reading the file, use "close file" (which is best practice) and it will give you the file path which you can input to the strip path function.
08-16-2019 11:23 AM
Thanks, Gregory. I had that originally but had passed the ref num through the case selector and then put the "close file" on the output side of the case selector (which obviously wasn't helpful.
)
08-17-2019 02:25 AM
I would recommend to simply use the file dialog and create the other path from the selection.
With the file dialog, you can skip all the code if the dialog gets cancelled without selecting a file.
There is no need for lowlevel file IO. All you need is "read delimited spreadsheet", giving you the 2D DBL array directly..
Also note that Index array is resizeable. The correct way to get the filename is "strip path". This keeps the extension too.
Here's how it could look like....