问题
I have a Simulink project with a lot of sub-projects. I have different environments for which I need to generate code from Simulink. So I am trying to set the Target Hardware from a MATLAB script. I can change other settings just fine, but I don't know how the name of the Target Hardware parameter so I can use set_param(). I have searched for it, but can't seem to find it and it appears that there isn't one.
models = {'Model1','Model2','Model2'};
for i=1:length(models)
open(char(models(i)));
set_param(char(models(i)),'TargetLang','C++');
set_param(char(models(i)),'CodeInterfacePackaging','Nonreusable function')
set_param(char(models(i)),'MaxIdLength','63')
set_param(char(models(i)),'ZeroExternalMemoryAtStartup','off');
set_param(char(models(i)),'Toolchain','Linaro Toolchain v4.8');
save_system(char(models(i)));
end
Does anyone know how to set the Target Hardware from a MATLAB script? It doesn't have to be set_param.
EDIT
I am using MATLAB 2014a and a screen shot is below.
回答1:
Is TargetHWDeviceType what you are after? This can be set with set_param
. It seems to apply to both Device Vendor and Device Type.
EDIT
The correct setting to use is ProdHWDeviceType. For example, to set it to an MPC55xx from Freescale, you need to do:
set_param(bdroot,'ProdHWDeviceType','Freescale->MPC55xx')
来源:https://stackoverflow.com/questions/28588112/how-to-set-target-hardware-in-simulink-embedded-coder-from-a-script