Main Content

getResourceCount

Number of instances of a resource

Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.

Description

example

count = getResourceCount(arduinoObj, resourceName) returns the number of resource instances with the name resourceName. Use this function to keep track of the number of resource objects that exist in the current workspace.

Examples

collapse all

Create a servo object, and get a count of resources.

Create a servo object.

arduinoObj  = arduino();
s = servo (arduinoObj, 'D2');

Check the current resource count.

arduinoObj = obj.Parent;
count = getResourceCount(arduinoObj,'servo')
count = 
1

Input Arguments

collapse all

Arduino object, specified as an object that is an internal variable called from within classes that derive from matlabshared.addon.LibraryBase.

Name of resource to count, specified as a character vector.

Output Arguments

collapse all

Number of instances for a given resource, returned as a double.

Version History

Introduced in R2015b