(# File: vectorIn.m
 #
 # Sha Rabii 22-Jan-1997
 # Sha Rabii 15-Oct-1997, added initialize statements to allow re-reading
 #                        of the file when a FOR statement is used.
 #)

#include <stdlib.h>

MODEL vectorIn

    stream parameter file;
    vector output y;
    char in[255];
    int n;

INITIALIZE

    n = 0;
    if (y.size() < 128) y.set_size(128);
    rewind (file);
    Enable();

EXECUTE

    if (fscanf(file, "%s\n", in) < 0) return;

    do {
      if (n >= y.size()) y.set_size(2 * y.size());
      (y)[n++] = atof(in);
    }
    while (fscanf(file, "%s\n", in) != EOF);

    y.set_size(n);

    y = y;			(# trigger y #)

END
