Data Input from Excel

I have a question reagarding the implementation of values into AnyBody. Is there an option to upload values like out of excel into it? Like the AnyOutputRef Option for the output from AnyBody to excel in the other direction. (At the moment I implement angle values as a group manual into my drivers. I don't use motion analysis with markers or a sensor technology.)

Thanks in advance.

Kind regards,

Hi @Juliana

You can load tabulated data (.txt or .csv) into your model using the AnyInputFile class.
The AnyMocap Framework does this for transfering joint angles from the marker tracking study to the inverse study.

Here is a snippet that takes a column of data from a file and uses it in a interpolation driver.

AnyKinEqInterPolDriver Actuator = {
  AnyRevoluteJoint &Jnt = Main.SliderCrank.Jnts.Shaft;
  Type = PiecewiseLinear;
  Data = data.Data;
  T = data.T;
  AnyInputFile data = {
    FileName = "data.txt";

If you need to output tabulated data from anybody you can use the AnyOutputFile class.
That would look something like:

AnyOutputFile OFile2 = {
  FileName = "data.txt";
  // You can reference as many variables as needed - read the class documentation for advanced options for searching multiple variables and formatting the file.
  AnyVar var1 = .MyMeasure.Val; 

Best regards,
AnyBody Technology

Thanks @Bjorn for your answer.


one more question regarding AnyOutputFile.
Sorry, if I missed something.. I had not find anything that helped me further.
It works that I get some output but I don't know, what I can do that for example the Moment isn't in the same line like the Force in the excel sheet. At the moment everything is in one line/row. I want to have it in different rows, when I define the AnyFloat new.

My code:

AnyOutputFile dataoutput= {
FileName = "dataoutput.csv"; //FILENAME ANPASSEN
NumberFormat = {
Digits = 8;
Width = 30;
Style = ScientificNumber;
SepSign = ",";
LineSepSign = "";
SepSpaceAutoOnOff = On ;
Header = {
TitleSectionOnOff = Off;
ConstSectionOnOff = Off;
VarSectionOnOff = Off;
ColumnNamesOnOff = Off;
LinePrefix = "";
AnyFloat JointReactionForce = {

  AnyFloat JointReactionMoment = {
     Main.Study.Model.HumanModel.BodyModel.SelectedOutput.Trunk.JointMomentMeasure.L1L2FlexExtMoment      };


Thanks in advance

Hi Juliana,

I am not sure I understood your question well, but if you try to write compressive components first, then shear ones, then moments, for example.
You can specify them in the needed order:

AnyFloat L1L2Compr = Main.Study.Model.HumanModel.BodyModel.SelectedOutput.Trunk.JointReactionForce.L1L2Compr;
AnyFloat L2L3Compr = Main.Study.Model.HumanModel.BodyModel.SelectedOutput.Trunk.JointReactionForce.L2L3Compr;
AnyFloat L3L4Compr = Main.Study.Model.HumanModel.BodyModel.SelectedOutput.Trunk.JointReactionForce.L3L4Compr;
AnyFloat L1L2Shear = Main.Study.Model.HumanModel.BodyModel.SelectedOutput.Trunk.JointReactionForce.L1L2Shear ;
AnyFloat L2L3Shear = Main.Study.Model.HumanModel.BodyModel.SelectedOutput.Trunk.JointReactionForce.L2L3Shear ;
AnyFloat L3L4Shear = Main.Study.Model.HumanModel.BodyModel.SelectedOutput.Trunk.JointReactionForce.L3L4Shear ;

In the output file you will get the following table:
t, L1L2Compr, L2L3Compr, L3L4Compr,...L1L2Shear, L2L3Shear, L3L4Shear,...
0, X0, Y0, Z0,...
tEnd, Xend, Yend, Zend, ...

Alternatively, you can write data as is and tweak your Output interpretation to use indices on the data, which might be easier.