Returning workspace outputs is supported with only single return argument
4 次查看(过去 30 天)
显示 更早的评论
Dear,
I am trying to run a simulink model in m-code while optimizing ADRC parameters with PSO, but I get an error:
‘Returning workspace outputs is supported with only single return argument’.
The first figure is 'PSO_ADRC' code and the second figure is the simulink model 'ADRC_test'.
Hope someone can help me, thanks.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1106365/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1106370/image.png)
0 个评论
回答(1 个)
Suman
2024-7-26
Hi Joe,
The problem lies with the way you are using sim() function in your code. sim() function can only return a single argument.
The single output from the sim function will contain the properties that you are trying to return. So you can first get the sim output in a single variable and then access and return those propertiy values.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Design Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!