Artifact bbb060ad26252990db35d73a4e32aa65aa43642e252fab934fada5dd99e4ddbd:
- File
mttroot/ntt/bin/trans/mttCountObjects.m
— part of check-in
[745f0b3e31]
at
2003-10-20 17:10:30
on branch origin/master
— Added initial revision of ntt:
new transformation tools for using bond graphs with Matlab.
Copyright 2003 Dr. Dominic J. Diston. (user: geraint@users.sourceforge.net, size: 689) [annotate] [blame] [check-ins using] [more...] - File ntt/bin/trans/mttCountObjects.m — part of check-in [af3953deae] at 2021-03-01 11:39:42 on branch master — Cleanup repository after cvs2git conversion. (user: jeff@gridfinity.com, size: 689) [annotate] [blame] [check-ins using]
function model = mttCountObjects(model) object_names = mttGetFieldNames(model,'obj') ; number_of_objects = length(object_names) ; model.count.obj = number_of_objects ; model.count.cr = 0 ; for i = 1:number_of_objects object_name = object_names{i} ; object = getfield(model,'obj',object_name) ; if ~isempty(object.cr) model.count.cr = model.count.cr + 1 ; end if isfield(object,'obj') next = mttCountObjects(object) ; model.count.obj = model.count.obj + next.count.obj ; model.count.cr = model.count.cr + next.count.cr ; end end