home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / sci / math / symbolic / 2234 < prev    next >
Encoding:
Text File  |  1992-08-19  |  1.3 KB  |  49 lines

  1. Newsgroups: sci.math.symbolic
  2. Path: sparky!uunet!stanford.edu!agate!boulder!sherod
  3. From: sherod@newton.Colorado.EDU (Scott Herod)
  4. Subject: Re: Mathematica - Output-Filename
  5. Message-ID: <1992Aug20.032011.17743@colorado.edu>
  6. Sender: news@colorado.edu (The Daily Planet)
  7. Nntp-Posting-Host: newton.colorado.edu
  8. Organization: University of Colorado, Boulder
  9. References: <Bt9FCB.KGn@watserv1.uwaterloo.ca>
  10. Date: Thu, 20 Aug 1992 03:20:11 GMT
  11. Lines: 36
  12.  
  13. In article <Bt9FCB.KGn@watserv1.uwaterloo.ca> mrs@.waterloo.edu (M. R. Sridhar) writes:
  14. >
  15. >stream = OpenWrite["filename", FormatType->OutputForm];
  16. >Write[stream, XX, "  ", YY];
  17. >Close[stream];
  18. >
  19. >In the above set of statements how do i make the output filename independent
  20. >of the program? i.e. i would like to specify the output filename before
  21. >these statements are executed. 
  22. >
  23. >Thanks in advance.
  24. >
  25. >Sridhar.
  26. >
  27.  
  28. In your example "filename" is a string so any one will do.  You can even
  29. create the name interactively by
  30.  
  31. file = InputString["What file do you want to create?"    ];
  32.  
  33. Alternately you could send string as a function argument.
  34.  
  35. dowrite[str_] :=
  36. Block[{stream},
  37.     stream := OpenWrite[strn,....];
  38.     .
  39.     .
  40. ]
  41.  
  42. Hope something like this helps. Feel free to send me mail if you have
  43. a question.
  44.  
  45. Scott Herod
  46. Applied Mathematics
  47. University of Colorado, Boulder
  48. (sherod@newton.colorado.edu)
  49.