The code foot1.PrescribedForce doesn't seem to make sense. foot1 is of type Model; what comes after the period must be a method in the Model class but there is no PrescribedForce() method. PrescribedForce is the name of another class (you have created an instance called force on line 42). How would this code know what to do if you had added more than one PrescribedForce to the model?i even tried "force=foot1.PrescribedForce.getRecordValues(s2);": "No constructor 'org.opensim.modeling.PrescribedForce' with matching signature found."
You can replace line 69 with this code, which prints the contents of the Model's ForceSet:
Code: Select all
foot1.computeStateVariableDerivatives(s2);
forceSet = foot1.getForceSet();
for i = 1:forceSet.getSize()
fi = forceSet.get(i-1);
fprintf('Force name: ''%s''\n', char(fi.getName()));
labels = fi.getRecordLabels();
values = fi.getRecordValues(s2);
for j = 1:labels.size()
fprintf('-> %s = %0.12f\n', char(labels.get(j-1)), values.get(j-1));
end
end