Using set_param on parameter 'ProdHWDeviceType'
显示 更早的评论
I need to use set_param on parameter 'ProdHWDeviceType' but it just doesn't work. I've tried it on other parameters and it works. Below is the code that doesn't work and the code that works.
WORKS: set_param(modelNames{i}, 'InlineParams', 'on') set_param(modelNames{i}, 'ArrayBoundsChecking', 'none') set_param(modelNames{i}, 'ModelReferenceNumInstancesAllowed', 'single')
DOESN'T WORK: set_param(modelNames(i), 'ProdHWDeviceType', 'Generic->Unspecified (assume 32-bit Generic)')
error: Invalid Simulink object specifier
From the documentation, 'Generic->Unspecified (assume 32-bit Generic)' is the string that needs to be fed in for the default values. But it just doesn't work. Bug in MATLAB?
回答(1 个)
Kaustubha Govind
2012-8-23
I think it's because you have a typo while indexing into the cell array modelNames. Instead of using modelNames{i}, you are using modelNames(i) - curly bracket vs. parentheses.
Try:
>> set_param(modelNames{i}, 'ProdHWDeviceType', 'Generic->Unspecified (assume 32-bit Generic)')
类别
在 帮助中心 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!