Main Content

target.update

Update target objects in internal database

Since R2023a

Description

target.update(targetObject) finds an object in the internal database that matches targetObject, and updates its properties. If the object in the database is associated with child objects, the child object definitions must match the corresponding child object definitions for targetObject. Otherwise, the function does not perform the update and produces an error.

example

Examples

collapse all

This example shows how you can modify a target object in the MATLAB® workspace and then update the corresponding object definition in the internal database.

Create a new target object.

myProcObject = target.create('Processor', 'Name', 'MyProcessor')
myProcObject = 

  Processor with identifier "MyProcessor" and properties:

    LanguageImplementations: [0×0 target.LanguageImplementation]
              NumberOfCores: 1
       NumberOfLogicalCores: 1
     NumberOfThreadsPerCore: 1
                  Overheads: [0×0 target.Overhead]
                     Timers: [0×0 target.Counter]
               Manufacturer: ''
                     AddOns: [0×0 target.AddOn]
                         Id: 'MyProcessor'
                       Name: 'MyProcessor'
                    IsValid: 1

Add the object to the internal database.

addedObject = target.add(myProcObject);
target.add summary:

    Objects added to internal database for current MATLAB session:
        target.Processor    "MyProcessor"

In the MATLAB workspace, modify a property of the object.

myProcObject.NumberOfCores = 2;

Update the object definition in the internal database.

target.update(myProcObject);
Target objects updated.

To verify that the object definition is updated in the internal database, retrieve the object from the internal database.

retrievedObject = target.get('Processor', myProcObject.Id)
retrievedObject = 

  Processor with identifier "MyProcessor" and properties:

    LanguageImplementations: [0×0 target.LanguageImplementation]
              NumberOfCores: 2
       NumberOfLogicalCores: 2
     NumberOfThreadsPerCore: 1
                  Overheads: [0×0 target.Overhead]
                     Timers: [0×0 target.Counter]
               Manufacturer: ''
                     AddOns: [0×0 target.AddOn]
                         Id: 'MyProcessor'
                       Name: 'MyProcessor'
                    IsValid: 1

Input Arguments

collapse all

Workspace objects that contain updated properties for objects in the internal database.

Example: target.update(myTargetObject)

Version History

Introduced in R2023a