For Søren, (AnyBody Support): Use of "AnyInputFile" in AnyBody ver 3.0 ..

Hello Søren,
Thank you very much for your last e-mail …
It will be quite work but I think we can change the “txt” files:
1 only line with the numbers separate with 1 white character.

But we have a doubt.

If we have a file “PelvisPos.txt”:
1 1.1 1.2 1.3
2 2.1 2.2 2.3
3 3.1 3.2 3.3
4 4.1 4.2 4.3

The number 1, 2, 3 (first number of line), are they necessary?

Please, could you explain us the following lines?
AnyVector PelvisPosTime=PelvisPosfile.T; // does it read the 1º
line of file (all the line until a return character???
AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
AnyVector PelvisRotY=PelvisPosfile.Data[1]; // 3º line of file?
AnyVector PelvisRotZ=PelvisPosfile.Data[2]; // 4º line of file?

In general, What is the meaning of “PelvisPosfile.T” without []?

Is there any documentation about this AnyInputFile function?

Many thanks in advance,

Javier Marin.
Ergonomics Group of University Zaragoza (SPAIN)

Hi Javier

I will try to explain how the AnyInputFile works:

The first column in the example is some sample time values, by default it
will read in the the first column as the Timevector “T” the subsequent
columns it will read as Data vectors and they will end up in the “Data”
object which is a matrix.

It is possible to use this object for reading in a single vector like

1.2 1.3 1.4 1.5

But is actually not designed for this kind of use, if doing so, the values
in the file will end up in the Timevector “T” , the Data object will be
empty.

The line in the example below :

AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?

Takes the second column of the file and assign it to the vector PelvisRotX

Similar the subsequent columns will be assigned to the y and z, again the
first column will go to the time vector T.

You can read more about the AnyInpuFile object on page 74 in the manual

I hope this made it more clear, otherwise please write again.

Best regards

Søren


From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com] On Behalf
Of jjmarinz
Sent: 03 January 2008 19:28
To: anyscript@yahoogroups.com
Subject: [AnyScript] For Søren, (AnyBody Support): Use of “AnyInputFile” in
AnyBody ver 3.0 …

Hello Søren,
Thank you very much for your last e-mail …
It will be quite work but I think we can change the “txt” files:
1 only line with the numbers separate with 1 white character.

But we have a doubt.

If we have a file “PelvisPos.txt”:
1 1.1 1.2 1.3
2 2.1 2.2 2.3
3 3.1 3.2 3.3
4 4.1 4.2 4.3

The number 1, 2, 3 (first number of line), are they necessary?

Please, could you explain us the following lines?
AnyVector PelvisPosTime=PelvisPosfile.T; // does it read the 1º
line of file (all the line until a return character???
AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
AnyVector PelvisRotY=PelvisPosfile.Data[1]; // 3º line of file?
AnyVector PelvisRotZ=PelvisPosfile.Data[2]; // 4º line of file?

In general, What is the meaning of “PelvisPosfile.T” without []?

Is there any documentation about this AnyInputFile function?

Many thanks in advance,

Javier Marin.
Ergonomics Group of University Zaragoza (SPAIN)

[Non-text portions of this message have been removed]

Hi Søren,
Thank you for you quick reply …
Excese me again, but we are a bit confused and we have a mess with
the columns and rows of file.

If we have a file “PelvisPos.txt”:
1 1.1 1.2 1.3
2 2.1 2.2 2.3
3 3.1 3.2 3.3
4 4.1 4.2 4.3

Then:
AnyVector PelvisPosTime=PelvisPosfile.T;
It reads: 1, 2, 3, 4 or 1, 1.1, 1.2, 1.3

AnyVector PelvisRotX=PelvisPosfile.Data[0];
It reads; 1.1, 2.1, 3.1, 4.1 or 2, 2.1, 2.2, 2.3

Our problem is the following:

We know that AnyInputFile class to read a space seperated ASCII file,
but how it does read the file? In rows of columns:
For example:

AnyFolder Mannequin ={

AnyFolder Posture ={

 AnyInputFile TimeSerie_file = {FileName = "txt\TimeSerie.txt";};
 AnyVector PelvisPosTime=TimeSerie_file.T;
 . . .

 // pelvis

 AnyInputFile PelvisThoraxFlexion_file =

{FileName “txt\PelvisThoraxFlexion.txt”;};
AnyVector PelvisThoraxFlexion=PelvisThoraxFlexion_file.T;

We had wrote the files with one only line:
TimeSerie.txt
3.16 3.36 3.56 3.76 3.96 4.16 4.36 4.56 …

PelvisThoraxFlexion.txt
-15.51033144 -19.25480164 -24.41783604 -30.1670546 -33.34338135 -
33.82061951 …

Is it OK? or we have to write the “TimeSerie.txt” file in column, for
example:
TimeSerie.txt:
3.16
3.36
3.56
3.76

Endfile.

Many thanks for you help.

— In anyscript@yahoogroups.com, “AnyBody Support” <support@…>
wrote:
>
> Hi Javier
>
>
>
> I will try to explain how the AnyInputFile works:
>
>
>
> The first column in the example is some sample time values, by
default it
> will read in the the first column as the Timevector “T” the
subsequent
> columns it will read as Data vectors and they will end up in
the “Data”
> object which is a matrix.
>
>
>
> It is possible to use this object for reading in a single vector
like
>
>
>
> 1.2 1.3 1.4 1.5
>
>
>
> But is actually not designed for this kind of use, if doing so, the
values
> in the file will end up in the Timevector “T” , the Data object
will be
> empty.
>
>
>
> The line in the example below :
>
> AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
>
>
>
> Takes the second column of the file and assign it to the vector
PelvisRotX
>
> Similar the subsequent columns will be assigned to the y and z,
again the
> first column will go to the time vector T.
>
>
>
> You can read more about the AnyInpuFile object on page 74 in the
manual
>
>
>
> I hope this made it more clear, otherwise please write again.
>
>
>
> Best regards
>
> Søren
>
>
>
>
>
> _____
>
> From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com]
On Behalf
> Of jjmarinz
> Sent: 03 January 2008 19:28
> To: anyscript@yahoogroups.com
> Subject: [AnyScript] For Søren, (AnyBody Support): Use
of “AnyInputFile” in
> AnyBody ver 3.0 …
>
>
>
> Hello Søren,
> Thank you very much for your last e-mail …
> It will be quite work but I think we can change the “txt” files:
> 1 only line with the numbers separate with 1 white character.
>
> But we have a doubt.
>
> If we have a file “PelvisPos.txt”:
> 1 1.1 1.2 1.3
> 2 2.1 2.2 2.3
> 3 3.1 3.2 3.3
> 4 4.1 4.2 4.3
>
> The number 1, 2, 3 (first number of line), are they necessary?
>
> Please, could you explain us the following lines?
> AnyVector PelvisPosTime=PelvisPosfile.T; // does it read the 1º
> line of file (all the line until a return character???
> AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
> AnyVector PelvisRotY=PelvisPosfile.Data[1]; // 3º line of file?
> AnyVector PelvisRotZ=PelvisPosfile.Data[2]; // 4º line of file?
>
> In general, What is the meaning of “PelvisPosfile.T” without []?
>
> Is there any documentation about this AnyInputFile function?
>
> Many thanks in advance,
>
> Javier Marin.
> Ergonomics Group of University Zaragoza (SPAIN)
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

Hi Javier,

Your question regarding AnyInputFile can be
explained using a demo file that I have created.

Please download the zip file “AnyInputFileDemo.zip”
from the “Files” section. It contain 4 seperate files
once you extract it:

  1. AnyInputFileDemo.any
  2. PelvisPos.txt
  3. PelvisPos2.txt
  4. PelvisPos3.txt

Open the AnyInputfileDemo.any using AnyBody,
and load the model. Browse to the section where
the explanation of the demo is given (include here):

// --------------Demo Start ----------------------------
// The following three examples show how AnyInputFile
// reads a .txt file. After you load the model, you can
// right click on variables in the model tree, and
// select “dump” to see the value of the variables.
// -----------------------------------------------------

// Example 01: The recommended way - the first column is
// for the Time T and the remaining column are Data.
// “PelvisPos.txt” contain following space seperated data:
// 1 1.1 1.2 1.3
// 2 2.1 2.2 2.3
// 3 3.1 3.2 3.3
// 4 4.1 4.2 4.3

AnyInputFile Data_file = {FileName = “PelvisPos.txt”;};

// You can assign the first column of the txt file to a
// variable using:
AnyVector Time_T = Data_file.T;

// You can assign all the remaining columns (Except first
// column), all at once, using:
AnyMatrix Data_mat = Data_file.Data;

// You can assign individual column (Except the first column)
// data to different variables, using:
AnyVector Data_Col01 = Data_file.Data[0];
AnyVector Data_Col02 = Data_file.Data[1];
AnyVector Data_Col03 = Data_file.Data[2];

// Example 02: txt file contain only one row of data.
// “PelvisPos2.txt” contain following space seperated data:
// 1 1.1 1.2 1.3

AnyInputFile Data_file2 = {FileName = “PelvisPos2.txt”;};

// In this case, the row become the .T and the .Data is empty:
AnyVector Time_T2 = Data_file2.T;
AnyMatrix Data_mat2 = Data_file2.Data;

// Example 03: txt file contain only one column of data.
// “PelvisPos3.txt” contain following space seperated data:
// 1
// 2
// 3
// 4

//The following three statements will fail:
//AnyInputFile Data_file3 = {FileName = “PelvisPos3.txt”;};
//AnyVector Time_T3 = Data_file3.T;
//AnyMatrix Data_mat3 = Data_file3.Data;
// --------------------- End of Demo ------------------

You can go to the model tree, right click on the variable name,
and select “dump”. You will be able to see the value inside the
variable in the message window.

Right now, the way you use AnyInputFile is similar to
Example 02. It works. However, the intent for AnyInputFile
is to read txt file that set up like the one in Example 01.

Hope this demo helps.

Thanks,
Leng-Feng

— In anyscript@yahoogroups.com, “jjmarinz” <jjmarin@…> wrote:
>
> Hi Søren,
> Thank you for you quick reply …
> Excese me again, but we are a bit confused and we have a mess with
> the columns and rows of file.
>
> If we have a file “PelvisPos.txt”:
> 1 1.1 1.2 1.3
> 2 2.1 2.2 2.3
> 3 3.1 3.2 3.3
> 4 4.1 4.2 4.3
>
> Then:
> AnyVector PelvisPosTime=PelvisPosfile.T;
> It reads: 1, 2, 3, 4 or 1, 1.1, 1.2, 1.3
>
> AnyVector PelvisRotX=PelvisPosfile.Data[0];
> It reads; 1.1, 2.1, 3.1, 4.1 or 2, 2.1, 2.2, 2.3
>
> Our problem is the following:
>
> We know that AnyInputFile class to read a space seperated ASCII file,
> but how it does read the file? In rows of columns:
> For example:
>
> AnyFolder Mannequin ={
>
> AnyFolder Posture ={
>
> AnyInputFile TimeSerie_file = {FileName = “txt\TimeSerie.txt”;};
> AnyVector PelvisPosTime=TimeSerie_file.T;
> . . .
>
> // pelvis
>
> AnyInputFile PelvisThoraxFlexion_file =
> {FileName “txt\PelvisThoraxFlexion.txt”;};
> AnyVector PelvisThoraxFlexion=PelvisThoraxFlexion_file.T;
>
> We had wrote the files with one only line:
> TimeSerie.txt
> 3.16 3.36 3.56 3.76 3.96 4.16 4.36 4.56 …
>
> PelvisThoraxFlexion.txt
> -15.51033144 -19.25480164 -24.41783604 -30.1670546 -33.34338135 -
> 33.82061951 …
>
> Is it OK? or we have to write the “TimeSerie.txt” file in column, for
> example:
> TimeSerie.txt:
> 3.16
> 3.36
> 3.56
> 3.76
> …
> Endfile.
>
> Many thanks for you help.
>
> — In anyscript@yahoogroups.com, “AnyBody Support” <support@>
> wrote:
> >
> > Hi Javier
> >
> >
> >
> > I will try to explain how the AnyInputFile works:
> >
> >
> >
> > The first column in the example is some sample time values, by
> default it
> > will read in the the first column as the Timevector “T” the
> subsequent
> > columns it will read as Data vectors and they will end up in
> the “Data”
> > object which is a matrix.
> >
> >
> >
> > It is possible to use this object for reading in a single vector
> like
> >
> >
> >
> > 1.2 1.3 1.4 1.5
> >
> >
> >
> > But is actually not designed for this kind of use, if doing so, the
> values
> > in the file will end up in the Timevector “T” , the Data object
> will be
> > empty.
> >
> >
> >
> > The line in the example below :
> >
> > AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
> >
> >
> >
> > Takes the second column of the file and assign it to the vector
> PelvisRotX
> >
> > Similar the subsequent columns will be assigned to the y and z,
> again the
> > first column will go to the time vector T.
> >
> >
> >
> > You can read more about the AnyInpuFile object on page 74 in the
> manual
> >
> >
> >
> > I hope this made it more clear, otherwise please write again.
> >
> >
> >
> > Best regards
> >
> > Søren
> >
> >
> >
> >
> >
> > _____
> >
> > From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com]
> On Behalf
> > Of jjmarinz
> > Sent: 03 January 2008 19:28
> > To: anyscript@yahoogroups.com
> > Subject: [AnyScript] For Søren, (AnyBody Support): Use
> of “AnyInputFile” in
> > AnyBody ver 3.0 …
> >
> >
> >
> > Hello Søren,
> > Thank you very much for your last e-mail …
> > It will be quite work but I think we can change the “txt” files:
> > 1 only line with the numbers separate with 1 white character.
> >
> > But we have a doubt.
> >
> > If we have a file “PelvisPos.txt”:
> > 1 1.1 1.2 1.3
> > 2 2.1 2.2 2.3
> > 3 3.1 3.2 3.3
> > 4 4.1 4.2 4.3
> >
> > The number 1, 2, 3 (first number of line), are they necessary?
> >
> > Please, could you explain us the following lines?
> > AnyVector PelvisPosTime=PelvisPosfile.T; // does it read the 1º
> > line of file (all the line until a return character???
> > AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
> > AnyVector PelvisRotY=PelvisPosfile.Data[1]; // 3º line of file?
> > AnyVector PelvisRotZ=PelvisPosfile.Data[2]; // 4º line of file?
> >
> > In general, What is the meaning of “PelvisPosfile.T” without []?
> >
> > Is there any documentation about this AnyInputFile function?
> >
> > Many thanks in advance,
> >
> > Javier Marin.
> > Ergonomics Group of University Zaragoza (SPAIN)
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

Hi again Leng-Feng,
The examples that you have sent us are perfect…
Now we understand all possibilities of AnyInputFile method.

Many thanks,

Javier Marin.

— In anyscript@yahoogroups.com, “Leng-Feng Lee” <lengfenglee@…>
wrote:
>
> Hi Javier,
>
> Your question regarding AnyInputFile can be
> explained using a demo file that I have created.
>
> Please download the zip file “AnyInputFileDemo.zip”
> from the “Files” section. It contain 4 seperate files
> once you extract it:
>
> 1. AnyInputFileDemo.any
> 2. PelvisPos.txt
> 3. PelvisPos2.txt
> 4. PelvisPos3.txt
>
> Open the AnyInputfileDemo.any using AnyBody,
> and load the model. Browse to the section where
> the explanation of the demo is given (include here):
>
> // --------------Demo Start ----------------------------
> // The following three examples show how AnyInputFile
> // reads a .txt file. After you load the model, you can
> // right click on variables in the model tree, and
> // select “dump” to see the value of the variables.
> // -----------------------------------------------------
>
> // Example 01: The recommended way - the first column is
> // for the Time T and the remaining column are Data.
> // “PelvisPos.txt” contain following space seperated data:
> // 1 1.1 1.2 1.3
> // 2 2.1 2.2 2.3
> // 3 3.1 3.2 3.3
> // 4 4.1 4.2 4.3
>
> AnyInputFile Data_file = {FileName = “PelvisPos.txt”;};
>
> // You can assign the first column of the txt file to a
> // variable using:
> AnyVector Time_T = Data_file.T;
>
> // You can assign all the remaining columns (Except first
> // column), all at once, using:
> AnyMatrix Data_mat = Data_file.Data;
>
> // You can assign individual column (Except the first column)
> // data to different variables, using:
> AnyVector Data_Col01 = Data_file.Data[0];
> AnyVector Data_Col02 = Data_file.Data[1];
> AnyVector Data_Col03 = Data_file.Data[2];
>
> // Example 02: txt file contain only one row of data.
> // “PelvisPos2.txt” contain following space seperated data:
> // 1 1.1 1.2 1.3
>
> AnyInputFile Data_file2 = {FileName = “PelvisPos2.txt”;};
>
> // In this case, the row become the .T and the .Data is empty:
> AnyVector Time_T2 = Data_file2.T;
> AnyMatrix Data_mat2 = Data_file2.Data;
>
> // Example 03: txt file contain only one column of data.
> // “PelvisPos3.txt” contain following space seperated data:
> // 1
> // 2
> // 3
> // 4
>
> //The following three statements will fail:
> //AnyInputFile Data_file3 = {FileName = “PelvisPos3.txt”;};
> //AnyVector Time_T3 = Data_file3.T;
> //AnyMatrix Data_mat3 = Data_file3.Data;
> // --------------------- End of Demo ------------------
>
>
> You can go to the model tree, right click on the variable name,
> and select “dump”. You will be able to see the value inside the
> variable in the message window.
>
> Right now, the way you use AnyInputFile is similar to
> Example 02. It works. However, the intent for AnyInputFile
> is to read txt file that set up like the one in Example 01.
>
>
> Hope this demo helps.
>
> Thanks,
> Leng-Feng
>
>
>
>
>
>
>
> — In anyscript@yahoogroups.com, “jjmarinz” <jjmarin@> wrote:
> >
> > Hi Søren,
> > Thank you for you quick reply …
> > Excese me again, but we are a bit confused and we have a mess
with
> > the columns and rows of file.
> >
> > If we have a file “PelvisPos.txt”:
> > 1 1.1 1.2 1.3
> > 2 2.1 2.2 2.3
> > 3 3.1 3.2 3.3
> > 4 4.1 4.2 4.3
> >
> > Then:
> > AnyVector PelvisPosTime=PelvisPosfile.T;
> > It reads: 1, 2, 3, 4 or 1, 1.1, 1.2, 1.3
> >
> > AnyVector PelvisRotX=PelvisPosfile.Data[0];
> > It reads; 1.1, 2.1, 3.1, 4.1 or 2, 2.1, 2.2, 2.3
> >
> > Our problem is the following:
> >
> > We know that AnyInputFile class to read a space seperated ASCII
file,
> > but how it does read the file? In rows of columns:
> > For example:
> >
> > AnyFolder Mannequin ={
> >
> > AnyFolder Posture ={
> >
> > AnyInputFile TimeSerie_file = {FileName
= “txt\TimeSerie.txt”;};
> > AnyVector PelvisPosTime=TimeSerie_file.T;
> > . . .
> >
> > // pelvis
> >
> > AnyInputFile PelvisThoraxFlexion_file =
> > {FileName “txt\PelvisThoraxFlexion.txt”;};
> > AnyVector PelvisThoraxFlexion=PelvisThoraxFlexion_file.T;
> >
> > We had wrote the files with one only line:
> > TimeSerie.txt
> > 3.16 3.36 3.56 3.76 3.96 4.16 4.36 4.56 …
> >
> > PelvisThoraxFlexion.txt
> > -15.51033144 -19.25480164 -24.41783604 -30.1670546 -33.34338135 -
> > 33.82061951 …
> >
> > Is it OK? or we have to write the “TimeSerie.txt” file in column,
for
> > example:
> > TimeSerie.txt:
> > 3.16
> > 3.36
> > 3.56
> > 3.76
> > …
> > Endfile.
> >
> > Many thanks for you help.
> >
> > — In anyscript@yahoogroups.com, “AnyBody Support” <support@>
> > wrote:
> > >
> > > Hi Javier
> > >
> > >
> > >
> > > I will try to explain how the AnyInputFile works:
> > >
> > >
> > >
> > > The first column in the example is some sample time values, by
> > default it
> > > will read in the the first column as the Timevector “T” the
> > subsequent
> > > columns it will read as Data vectors and they will end up in
> > the “Data”
> > > object which is a matrix.
> > >
> > >
> > >
> > > It is possible to use this object for reading in a single
vector
> > like
> > >
> > >
> > >
> > > 1.2 1.3 1.4 1.5
> > >
> > >
> > >
> > > But is actually not designed for this kind of use, if doing so,
the
> > values
> > > in the file will end up in the Timevector “T” , the Data object
> > will be
> > > empty.
> > >
> > >
> > >
> > > The line in the example below :
> > >
> > > AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
> > >
> > >
> > >
> > > Takes the second column of the file and assign it to the vector
> > PelvisRotX
> > >
> > > Similar the subsequent columns will be assigned to the y and z,
> > again the
> > > first column will go to the time vector T.
> > >
> > >
> > >
> > > You can read more about the AnyInpuFile object on page 74 in
the
> > manual
> > >
> > >
> > >
> > > I hope this made it more clear, otherwise please write again.
> > >
> > >
> > >
> > > Best regards
> > >
> > > Søren
> > >
> > >
> > >
> > >
> > >
> > > _____
> > >
> > > From: anyscript@yahoogroups.com
[mailto:anyscript@yahoogroups.com]
> > On Behalf
> > > Of jjmarinz
> > > Sent: 03 January 2008 19:28
> > > To: anyscript@yahoogroups.com
> > > Subject: [AnyScript] For Søren, (AnyBody Support): Use
> > of “AnyInputFile” in
> > > AnyBody ver 3.0 …
> > >
> > >
> > >
> > > Hello Søren,
> > > Thank you very much for your last e-mail …
> > > It will be quite work but I think we can change the “txt” files:
> > > 1 only line with the numbers separate with 1 white character.
> > >
> > > But we have a doubt.
> > >
> > > If we have a file “PelvisPos.txt”:
> > > 1 1.1 1.2 1.3
> > > 2 2.1 2.2 2.3
> > > 3 3.1 3.2 3.3
> > > 4 4.1 4.2 4.3
> > >
> > > The number 1, 2, 3 (first number of line), are they necessary?
> > >
> > > Please, could you explain us the following lines?
> > > AnyVector PelvisPosTime=PelvisPosfile.T; // does it read the 1º
> > > line of file (all the line until a return character???
> > > AnyVector PelvisRotX=PelvisPosfile.Data[0]; // 2º line of file?
> > > AnyVector PelvisRotY=PelvisPosfile.Data[1]; // 3º line of file?
> > > AnyVector PelvisRotZ=PelvisPosfile.Data[2]; // 4º line of file?
> > >
> > > In general, What is the meaning of “PelvisPosfile.T” without []?
> > >
> > > Is there any documentation about this AnyInputFile function?
> > >
> > > Many thanks in advance,
> > >
> > > Javier Marin.
> > > Ergonomics Group of University Zaragoza (SPAIN)
> > >
> > >
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
>