Fill an array from an (unreferenced) list?
liwenna
liwenna at gmail.com
Fri Feb 4 12:41:39 UTC 2011
So I checked it and it is indeed like I described above... just a
denominator, as far as I can see. In addition, I checked what would
happen if I would use input #1 for the separate inputs and things work
just fine... obviously in this script (partly pasted below) the first
file is opened(as #1), the array is filled, and then #1 is closed
before the next file is opened as input#1. If for some reason you'd
first want to open several files simultaneously and only later fill
arrays or whatever you're going to do with the info from the files...
it would of course be needed to give a separate 'name' #1, #2, etc) to
each of the inputs from different files.
best,
liw
'fill the array negwords
'Read in the stimuli into the array negwords
Open "negativewords.txt" For Input As #1
For n = 0 To 17
Input #1, negwords(n)
Next n
Close #1
'fill the array poswords
'Read in the stimuli into the array poswords
Open "positivewords.txt" For Input As #1
For n = 0 To 17
Input #1, poswords(n)
Next n
Close #1
On Feb 3, 11:54 am, liwenna <liwe... at gmail.com> wrote:
> If I remember correctly the number is simply a denominator for 'the
> input' ...
>
> so... in the above example I needed 3 different .txt files to be put
> into 3 different arrays... (one with positive words, one negative and
> one neutral). I'll check for you tomorrow but if I remember correctly
> I repeated the script three times but used input#1, input#2 and
> input#3. That would make the number just 'a name' given to that input
> function.
>
> "the file referenced by filenumber" would then refer to this line in
> the above code: Open "YOURFILE.txt" For Input As #1
>
> On Feb 2, 8:21 pm, "Caleb J. Picker" <dbzgtfan4e... at gmail.com> wrote:
>
> > Hello,
>
> > I have a question. I looked in the e-basic help and it says that the
> > Input[#] function does this:
>
> > Reads data from the file referenced by filenumber into the given variables.
>
> > Why is it the case that when you type '...For Input as #1' that his
> > necessarily reads one line at a time. What I am saying is, I do not
> > understand this function. What does the Input [#] function really mean? If I
> > were to change the '1' value to '2', would this input every other line?
> > Would inputting a large integer value read every nth value of that integer?
>
> > Thanks in advance.
>
> > Caleb
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
More information about the Eprime
mailing list