Main Content


Export target object data

Since R2019b


target.export(targetObject) exports the specified target object data to a MATLAB® function, registerTargets.m. Use the generated file to share target feature data between sessions and computers. When you run registerTargets.m, it recreates the target object and adds the object to an internal database.

target.export(targetObject,Name,Value) exports the specified target object data using one or more name-value pair arguments.


collapse all

You can share hardware device data across computers and users.

Specify two hardware devices.

langImp1 = target.create('LanguageImplementation', ...
                          'Name', 'MyLanguageImplementation1', ...
                          'Copy', 'ARM Compatible-ARM Cortex');

langImp2 = target.create('LanguageImplementation', ...
                          'Name', 'MyLanguageImplementation2', ...
                          'Copy', 'Atmel-AVR');

myProc1 = target.create('Processor','Name','MyProcessor1');
myProc1.LanguageImplementations = [langImp1, langImp2];
objectsAdded1 = target.add(myProc1, ...
                          'UserInstall',true, ...

myProc2 = target.create('Processor','Name','MyProcessor2');
objectsAdded2 = target.add(myProc2, ...
                          'UserInstall',true, ...

Run the target.export function.

target.export([myProc1, myProc2], 'FileName', 'exportMyProcFunction')

The function generates exportMyProcFunction.m in the current working folder. Use the generated function to share hardware device data across computers and users. For example, on another computer, run this command:

addedObjects = exportMyProcFunction;

The generated function recreates and adds the objects to an internal database.

If you want the hardware device data to persist over MATLAB sessions, run:

addedObjects = exportMyProcFunction('UserInstall',true);

Input Arguments

collapse all

Specify the target objects that you want to export.

Example: target.export(myTargetObject);

Name-Value Arguments

Example: target.export(myTargetObject,'FileName', 'exportMyTargetFn');

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Specify name of MATLAB function file that contains exported target data.

  • true –– Overwrite MATLAB function file if it exists.

  • false –– Generate error if MATLAB function file exists. File is not overwritten.

Version History

Introduced in R2019b