comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Naming the file as open through dialogue_pickfile
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Naming the file as open through dialogue_pickfile [message #92746] Mon, 22 February 2016 21:33 Go to next message
mj999fine is currently offline  mj999fine
Messages: 4
Registered: February 2016
Junior Member
I am trying to read a file through the command

path='C:\LWP\'
file=dialog_pickfile(PATH =path,filter ='*TXT')

which has data to read and it is stored in some array.
The file names in the "PATH" folder has a sequence "A1.txt", "A2.txt", .... and 15 others.

Now I want to store the data in some another file.
I want to store data in a new sequence such as "MA1.txt", which suggests the file has been read.
so i want to add "M" in the newly saved file name along with old file name.

EX:
"M"+ "(original file name)".TXT

Is it possible in IDL 8.4 Win PC ?
Re: Naming the file as open through dialogue_pickfile [message #92748 is a reply to message #92746] Tue, 23 February 2016 06:27 Go to previous messageGo to next message
Burch is currently offline  Burch
Messages: 28
Registered: December 2013
Junior Member
On Monday, February 22, 2016 at 11:33:35 PM UTC-6, mj99...@gmail.com wrote:
> I am trying to read a file through the command
>
> path='C:\LWP\'
> file=dialog_pickfile(PATH =path,filter ='*TXT')
>
> which has data to read and it is stored in some array.
> The file names in the "PATH" folder has a sequence "A1.txt", "A2.txt", .... and 15 others.
>
> Now I want to store the data in some another file.
> I want to store data in a new sequence such as "MA1.txt", which suggests the file has been read.
> so i want to add "M" in the newly saved file name along with old file name.
>
> EX:
> "M"+ "(original file name)".TXT
>
> Is it possible in IDL 8.4 Win PC ?

Since the output of dialog_pickfile() is a string you can use strmid() to remove the path. For example,

IDL> print, file
C:\LWP\A1.txt
IDL> print, strmid(file, 7)
A1.txt
IDL> print, 'M' + strmid(file, 7)
MA1.txt

Further info on strmid() and other useful routines:
http://www.exelisvis.com/docs/STRMID.html
http://www.exelisvis.com/docs/routines-87.html

-Jeff
Re: Naming the file as open through dialogue_pickfile [message #92749 is a reply to message #92748] Tue, 23 February 2016 07:23 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den tisdag 23 februari 2016 kl. 15:27:56 UTC+1 skrev Jeff B:
> On Monday, February 22, 2016 at 11:33:35 PM UTC-6, mj99...@gmail.com wrote:
>> I am trying to read a file through the command
>>
>> path='C:\LWP\'
>> file=dialog_pickfile(PATH =path,filter ='*TXT')
>>
>> which has data to read and it is stored in some array.
>> The file names in the "PATH" folder has a sequence "A1.txt", "A2.txt", .... and 15 others.
>>
>> Now I want to store the data in some another file.
>> I want to store data in a new sequence such as "MA1.txt", which suggests the file has been read.
>> so i want to add "M" in the newly saved file name along with old file name.
>>
>> EX:
>> "M"+ "(original file name)".TXT
>>
>> Is it possible in IDL 8.4 Win PC ?
>
> Since the output of dialog_pickfile() is a string you can use strmid() to remove the path. For example,

Or file_basename().
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Summation Image arrays
Next Topic: disable content assist?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:23:35 PDT 2025

Total time taken to generate the page: 0.00493 seconds