Re: file name as mathematica function parameter
- To: mathgroup at smc.vnet.net
- Subject: [mg5036] Re: file name as mathematica function parameter
- From: Harald Berndt <haberndt at dnai.com>
- Date: Sat, 19 Oct 1996 16:40:37 -0400
- Organization: DNAI ( Direct Network Access )
- Sender: owner-wri-mathgroup at wolfram.com
Mel Siegel wrote:
>
> I would like to use a file name as a function parameter:
>
> myfunction[filename_] := (
> ...;
> mydatalist = Read[filename];
> (* or Get[filename] or << filename *)
> ...;
> ...)
I have written and continuously use many functions that take filenames
as argument, without any problems. I recommend you carefully check the
syntax you are calling the function with. One very formal way of
insuring correct syntax of filenames (at least this works on the Mac,
DOS-based filenaming is a bit of a problem for Mma and I haven't worked
in that environment as much. I believe it works there, too, though ...)
is to generate a list of filenames I want to manipulate using
and then use an index into nL as argument to myfunction[].
--
______________________________________________________________________
Harald Berndt, Ph.D. Research Specialist,
Consultant
Phone: 510-652-5974 FAX: 510-215-4299
______________________________________________________________________
"I am what I am".................................. .Popeye the Sailor
(KRYTEN:.............Are you sure? I always thought it was Descartes!)
(LISTER:.So did I, man! It's so easy to get those two dudes mixed up!)