I'm trying to remove some muscles from model. It does not give me error and before printing model when I check number of muscles it seems they have been removed however, after printing model, there is no changes. Do I need to finalize or something like that before printing? my code is
Code: Select all
import org.opensim.modeling.*;
Logger.addSink(JavaLogSink());
osismmodel = Model('subject_walk_armless.osim');
osismmodel.finalizeConnections();
SimMusclename=["bflh_r","bfsh_r","gaslat_r"]
c=0;
for m = 0:osismmodel.getMuscles().getSize()-1
musc = osismmodel.updMuscles().get(c);
if ~sum(strcmp(char(musc.getName()), SimMusclename))
osismmodel.updMuscles().remove(c)
else
c=c+1;
end
end
osismmodel.print('subject_walk_armless_DeGroote.osim');