If I understand correctly, you have defined MFdL1L3_CSA as an AnyVar. AnyVar holds a single dimensional value and you can't really index an AnyVar. You would need to use a multi-dimensional variable like an AnyFloat or AnyVector.
Then, to index the value, you would need to provide the proper path to the iStep: so something like:
Thank you for your advice, I corrected my previous mistake according to the way you said. But as you can see, I want to modify my mannequin with the value of each iStep. But how do I have the program automatically rerun InverseDynamics after each iStep modification of the model to get new mechanical parameters?
Sorry, I probably didn't describe it very well before. I want to use two variables, one is the cross-sectional area of the muscle and the other is the maximum activation of the muscle. I defined two studies in my program, one to obtain the maximum activation of the muscles under the current posture and cross-sectional area, and one to obtain the new muscle cross-sectional area using the formula using the maximum activation input. I want to update the cross-sectional area of the muscle in each istep and get a new muscle maximum activation du based on the new muscle cross-sectional area.I wonder if there is any way this can be implemented.
I think what you would like to do is perhaps not possible.. Physiologically, the cross-sectional area is modelled using kinematic parameters. You could perhaps consider using AnyMuscleModelUsr1, which allows you to define the strength of a muscle as a function of time, position, and velocity variable. This would still exclude making strength a function of muscle activity of the previous step.
I didn't consider all the possibilities in my previous reply. There seems to be a way to do what you want to do through the Python hook. Please see here for more info on how to use an external Python function with AnyBody. There is also a small example at the end of the page that shows a differentiation example using the values from the previous time step. Hopefully, this helps you out.
Thank you for your reply. In fact, I've done this before using python. The reason why I want anybody to do this is that if I do this in python but I want to see the result, I need to define it in python myself, and whenever I want to see some new parameter I have to rewrite the python program and run it, which is laborious and time-consuming. So if using python, is there a more convenient way to see the results?
At the moment, there isn't a more convenient way I think. If you want to see a specific parameter, you would need to program it in AnyScript or Python. So one way or the other, you would need to rewrite some code.