[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

# Re: Passing parameters with a file

- To: femm@yahoogroups.com
- Subject: Re: Passing parameters with a file
- From: jim271@hotmail.com
- Date: Tue, 21 Aug 2001 16:54:37 -0000
- In-reply-to: <253D3D5DE6D6F04092A36D739A8F2976013B04@dvrfile.dvrhome.com>
- User-agent: eGroups-EW/0.82

    Thank you, Carl.

    This is just what I needed to get my program working.

    Jim

    =============================================================

    --- In femm@y..., "Carl Kopin" <ckopin@d...> wrote:
    > Hi Jim,
    >
    > Try this:
    >
    > In the preprocessor create your file like this:
    >
    > handle=openfile('mydata.txt','w')
    > write(handle,'my comment 1\n', 'my comment
    > 2\n',data1,'\n',data2[,'\n',data3[,...]])
    > closefile(handle)
    >
    >
    > In the postprocessor read your file as follows:
    >
    > handle=openfile('mydata.txt','r')
    > line1,line2,d1,d2=read(handle,'*l','*n','*n')
    > close(handle)
    >
    > Writing the mydata.txt file is simple, the trick is to properly
    read it.
    > If you ad a comment line or to in the beginning of your file, you
    have
    > to read it it/them first before your data, that's why you add '*l'
    ( the
    > "l" is a lower case L, which means to read whole line) in the
    beginning
    > one for each line, and then you add the '*n' (to read numbers) as
    many
    > times as needed to read your data. You don't need to read the whole
    > file, but you must read it from the very beginning to the last
    point of
    > your interest. You do not need your comment lines in your
    postprocessor,
    > but you must read them to a "junk" var in order to access the data
    part.
    > To send/read characters, in the preprocessor use the form of 'my
    > char\n', in the postprocessor use '*w' that stands for word. You
    can use
    > "new line" (\n) or tab (\t) as your delimiters. (Are spaces OK,
    too? I
    > am not sure, did not try.)
    >
    > I think, this will help you (and possibly others, too).
    > Other comments are welcomed.
    > Carl
    >
    > -----Original Message-----
    > From: jim271@h... [mailto:jim271@h...]
    > Sent:	Sunday, August 19, 2001 08:23
    > To:	femm@y...
    > Subject:	[femm] Re: Lua sample of line integral
    >
    > Dave,
    >
    > Thank you for the example. This is very helpful.
    >
    >
    > Dave: " As far as getting information from one iteration to the
    next,
    > or from the preprocessor to the postprocessor, perhaps the easiest
    > way to do this is via the use of a temporary file. I have used a
    > temporary file in this example to send the current plunger position
    > to the postprocessor so that it can write this piece of info to the
    > output file. "
    >
    > I can get the post processing file to read one variable that is
    > passed by the main script file, but I can't seem to get it to read
    > two or more data values from the same line of the data file.
    >
    > Can someone please show an example of reading multiple variables
    from
    > a file by the post processor?
    >
    > -- Jim
    >
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/

- References:
  - RE: [femm] Re: Lua sample of line integral
    - From: "Carl Kopin" <ckopin@davinciresearch.com>

- Prev by Date: RE: [femm] Re: Lua sample of line integral
- Next by Date: tetgen
- Previous by thread: RE: [femm] Re: Lua sample of line integral
- Next by thread: i need help , it is urgent ( simulation of stepper motor)
- Index(es):
  - Date
  - Thread