Main Content

findUsages

Find out how a unit or unit prefix is used

Description

example

[componentList,usageTable] = findUsages(obj) returns a vector of components that use the unit or unit prefix object obj and a table providing details about how the obj is used in the BuiltInLibrary and UserDefinedLibrary. For details of what SimBiology® checks to decide whether a unit or unit prefix is used by another component, see Component Usage.

example

[componentList,usageTable] = findUsages(obj,model) also searches for usages of the obj in model, which is a SimBiology model, or a vector of model objects.

example

[componentList,usageTable] = findUsages(obj,model,dose) also searches for usages of the obj in dose, which is a ScheduleDose object, RepeatDose object, or a vector of dose objects.

Examples

collapse all

Create the unit object.

gram = sbioselect('Type','Unit','Name','gram');

Check and see how the gram unit is used in the built-in library. If you have a custom library, the function also searches it.

gramUsage = findUsages(gram)
gramUsage = 
   SimBiology Unit Array

   Index:    Library:    Name:      Composition:                              Multiplier:
   1         BuiltIn     gram       gram                                      1          
   2         BuiltIn     joule      (meter^2*kilogram)/second^2               1          
   3         BuiltIn     calorie    (meter^2*kilogram)/second^2               4.1868     
   4         BuiltIn     pascal     kilogram/(meter*second^2)                 1          
   5         BuiltIn     watt       (kilogram*meter^2)/second^3               1          
   6         BuiltIn     newton     (kilogram*meter)/second^2                 1          
   7         BuiltIn     dyne       (gram*centimeter)/second^2                1          
   8         BuiltIn     volt       (kilogram*meter^2)/(ampere*second^3)      1          
   9         BuiltIn     farad      (ampere^2*second^4)/(kilogram*meter^2)    1          
   10        BuiltIn     ohm        (kilogram*meter^2)/(ampere^2*second^3)    1          
   11        BuiltIn     siemens    (ampere^2*second^3)/(kilogram*meter^2)    1          
   12        BuiltIn     weber      (kilogram*meter^2)/(ampere*second^2)      1          
   13        BuiltIn     tesla      kilogram/(second^2*ampere)                1          
   14        BuiltIn     henry      (kilogram*meter^2)/(ampere^2*second^2)    1          

Input Arguments

collapse all

Unit or unit prefix, specified as a Unit object, or UnitPrefix object

SimBiology model, specified as a Model object or vector of model objects.

Dose object, specified as a ScheduleDose object, RepeatDose object, or vector of dose objects.

Output Arguments

collapse all

List of model components that use the unit or unit prefix, returned as a vector.

Usage information, returned as a table. Table variables are:

  • Component– a vector of components that use the obj

  • Property– a cell array of character vectors listing the corresponding properties that use the obj, and

  • Usage– a cell array of character vectors stored in the relevant properties, that is, InitialAmountUnits, CapacityUnits, ValueUnits, TimeUnits, AmountUnits, RateUnits, or Composition.

Version History

Introduced in R2016b