メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

target.update

Update target objects in internal database

R2023a 以降

説明

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.

すべて折りたたむ

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

入力引数

すべて折りたたむ

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

例: target.update(myTargetObject)

バージョン履歴

R2023a で導入