How to get parameter name of "Target hardware"-Field in "Run on target hardware" in Matlab Simulink?

508 views Asked by At

I have seen that something similar (yet not exactly the same) has already been asked, yet not for the same field, nor even the same menu.

I am using Matlab Simulink R2014a and looking to set the value of a parameter in the following way:

RoHComponent = myConfigSet.getComponent('Run on Hardware');
set_param(RoHComponent, 'TargetHardware', 'Raspberry Pi');

However, the concerned field does not tell its name in the help menu, but I need to set it by command line. Could someone tell me its name? I have tried 'TargetHardware' and similar things, but I just can't find it, and "What's this?" does not tell the parameter name.

Have a nice day,

PS: I'd love to insert a screenshot, but as I am some newbie, I can't yet add one as my reputation is too low so I can't show it to you directly. The concerned menu is under: Configuration> Run on Target Hardware > Target Hardware selection > Target Hardware:

2

There are 2 answers

0
Domack On BEST ANSWER

Sooo, this turns out to become some sort of a tradition: I ask a seemingly too specific question, and end up answering it myself. ^^;

MyModel = load_system('mymodel');

% list configuration sets
CSNames = getConfigSets(MyModel);
ConfSet = getConfigSet(MyModel, CSNames{1});

% get the hardware component
RTSC = ConfSet.getComponent('Run on Hardware');

% have fun with it
RTSC.getProp('TargetExtensionPlatform')
RTSC.setProp('TargetExtensionPlatform', 'None')
RTSC.setProp('TargetExtensionPlatform', 'Raspberry Pi')

Or in the short version:

ConfSet .getProp('TargetExtensionPlatform')
ConfSet .setProp('TargetExtensionPlatform', 'None')
ConfSet .setProp('TargetExtensionPlatform', 'Raspberry Pi')

Yet the longer version allows an insight of how I found it.

Of course, there is a bunch of checks to be done to ensure that the component exists, and that the property is properly set/read.

0
Matthias W. On

You can use method getProp() an a ConfigSet object to get a list of available properties. This is how I found out that I can use the following call to determine if my model configuration settings support variable-size signals:

>> confSet.getProp('SupportVariableSizeSignals')

ans =

on

It seems that you can then use both setProp and set_param to set the new value.

I haven't tested it, but it seems that you cann call getProp on components/subcomponents as well. However, the properties seem to be transparent to the "parent" ConfigSet object.

TL;DR: getProp() helps to identify properties whose name you don't know, but can guess from the list of properties.