Text file data into AnyVector?

Hi there,

I’m currently stuck with how to read data from a text file and how to store this into an AnyVector variable.

AnyInputFile TimeArray = 
{
  FileName = "TimeArrayData.txt";
};

How do I set a variable, such as eg. AnyVector MyTimeArray to contain the data read from the text file??

I’ve looked through the reference manual and still haven’t found a solution.

Kind regards

Hi Jared,

When you read in data from a file you will get a “T” array containing the time values specified int he first collumn and data values will seen in the “Data” object .

So you cannot dircetly read the data into an AnyVector.

What you typicall do is the following:

[ol]
[li]Make an interpolation function using the data, use an AnyFunInterpol object for this
[/li][li] If you look up this object in tghe reference manul and scroll to the bottom of the page you will see an example link.
[/li][li] If you really want an anyvector containing the values in the file and you do not care for the time values you can use directly the Data object.
[/li][li] So then write something like AnyVector test =…MyData.Data;
[/li][li] Data will be a matix you may need to write AnyVector test =–MyData.Data[0];
[/li][/ol]

Hope it helps

Best regards
Søren