Main Content

target.clear

Clear all target objects from internal database

Since R2023a

Description

example

target.clear() clears target objects from an internal database. The function clears only objects added to the database in the current MATLAB® session.

example

target.clear(Name,Value) clears target objects from the internal database using Name,Value arguments. For example, you can clear persistent objects added in previous MATLAB sessions.

Examples

collapse all

This example shows how you can use target.clear to clear target object data from the internal database.

Create an array of target objects.

langImp = target.create('LanguageImplementation', ...
                        'Name', 'LanguageImplementation1', ...
                        'Copy', 'Atmel-AVR');
 
proc1 = target.create('Processor', 'Name', 'Processor1');
proc2 = target.create('Processor', 'Name', 'Processor2');
 
board1 = target.create('Board', 'Name', 'Board1');
 
proc2.LanguageImplementations = langImp;
board1.Processors = proc2;
objects = [board1 proc1 proc2 langImp];

For the current MATLAB session, add the objects to the internal database.

target.add(objects);

To clear the added objects from the internal database, run:

target.clear()

The command target.clear() is equivalent to target.clear(MATLABSession=true).

For persistence over MATLAB sessions, add the objects to the internal database by using the UserInstall=true name-value argument:

target.add(objects, UserInstall=true);

To clear the persistent objects from the internal database, run:

target.clear(UserInstall=true)
When you clear "User Install", persistent data will be removed permanently 
from an internal database. Enter Y (default) to continue or N to stop.

If you enter Y, the function removes the persistent objects from the internal database.

Input Arguments

collapse all

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: target.clear(UserInstall=true);

Specify removal of target objects added to the internal database in current MATLAB session:

  • true –– Remove objects added in current session.

  • false –– Do not remove objects added in current session.

Example: target.clear(MATLABSession=true);

Data Types: logical

Specify removal of persistent target objects added to the internal database in current and previous MATLAB sessions:

  • true –– Remove objects added in current and previous sessions.

  • false –– Do not remove objects added in previous sessions.

Example: target.clear(UserInstall=true);

Data Types: logical

Version History

Introduced in R2023a