Command Line Simscape Model Generation - Powergui Error

7 次查看(过去 30 天)
Hi,
I'm trying to build a Simscape model programmatically from a script file. The model seems to build correctly until I add the "powergui" element. When the power gui is added or interacted with it throws an error popup with the following:
" Error evaluating 'Mask Dialog' callback of PSB option menu block block (mask) 'XXX/powergui'. Callback string is 'powergui ('Simulation Type', [],[],gcb);'
Index in position 1 exceeds array bounds (must not exceed 1"
This occurs even only when using a 'Half-Bridge Converter' and the powergui block. It does not matter whether I add the powergui through the command line or via the library selection. It also affects other Simscape models that I have loaded. The only work around I've found is to use a `clear all` which seems to stop the error. Given it applies across the models, I imagine its not a problem with powergui initialisation. Perhaps there is a simulation setting which I've missed that needs to be set for the callback to execute? Does anyone have information on this error?
Thanks!

回答(1 个)

Naman Bhaia
Naman Bhaia 2019-2-25
Hey Callum,
Since this error is very specific, it will need reproduction of the entire model or at least a subpart of it to really understand where it is going wrong. Without that, the only possible work-arounds I can suggest are
  1. You can check if there is another file named as ‘powergui.*’ in your current MATLAB workspace/folder. If any are found, please rename them. This is done because the model is taking higher preference in the MATLAB path and shadows the "powergui" block file. When you add a "powergui" block in any Simulink model, Simulink is trying to open your "powergui.slx" model instead of the "powergui" block and reports an error. After renaming, try to run the following command in MATLAB command line:
>> restoredefaultpath
2. Some corrupted MATLAB preferences could be a possible cause of this issue. To resolve this, please regenerate you MATLAB preferences directory using the instructions given in the below link:

类别

Help CenterFile Exchange 中查找有关 Troubleshooting 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by