Error(scr.exp3) :

Find attached a small example:

If the 11th line of the “C3DSettings.any” is changed to:

FileName = "../Input/"+ NameOfFile[b]2[/b] + ".c3d"; //add the extension to the file name here

I receive the following error:

ERROR(SCR.EXP3) :   C:/Users/../Mo..l2/ReadPatientData.any(25)  :   'TrialNo'  :  Index [1] out of range for 'AnyFloat[ ][ ]'

Why?

Thanks

After some testing I think this is problem with the strval function:

It doesn’t seem to work properly together with the format specifier.

See “ReadPatientData.any”

AnyString C3DFile = strval(TrialNo, "%03g") + "_" + Name + Motion;

Hi Fritz,

 AnyString C3DFile = strval(TrialNo, "%03g") + "_" + Name + Motion;

gives me: “025_K1L_GaitNormal”

What do you expect? As I read your formatting specification you request a string with 3 symbols preceding with zeros, and it should use shortest representation either scientific or full floating - so for 25 works well.

Regards,
Pavel

Hi Pavel

Did you try to use this string to load the c3d file?

You have to change the 11th line of the “C3DSettings.any” to (see above):

FileName = "../Input/"+ NameOfFile[b]2[/b] + ".c3d"; //add the extension to the file name here

Then I receive the error otherwise not.

Thanks

Ok, now makes more sense.

So, the problem is that the C3D filename is requested at the moment when everything else has not been read yet (it is a very special object that is used to configure many other objects). These expressions are being evaluated a little later. And there is no trivial work around.

Do you run these simulations from Matlab/Python? If so - possibly it would be easiest to pass the name of C3D file as a define from outside. This way it will definitely be ready for the loading time (which happens first thing, I believe). This is how we do it, and I am suggesting because this is probably easier to implement than something else.

You could also look how we recommend to do batch processing here.
Kind regards,
P.

My goal is that both is possible:

[ol]
[li]Run it from AnyBody and select a subject[/li][li]Run it as batch from Matlab[/li][/ol]
Of course I could create a subject-specific ANY-file using Matlab, and run it in batch mode.

But in general it should be possible to use the strval function during the loading process.

The problem is not in strval. The problem is that you are trying to read an input file before reading a C3D file, which has the priority.

Could you make an include file with a set of #defines to represent a certain subject/scenario? and then switch between these include files?

I believe batch processing framework with multiple folders/main files that i mentioned may allow you do the same.

Kind regards,
Pavel

Yes, I will do that.

Nevertheless it’s annoying that it’s not possible to “read an input file before reading a C3D file”.

This should be fixed in upcoming versions.

Thanks