'InitFcn' callback error
70 ビュー (過去 30 日間)
古いコメントを表示
I was trying to design and tune a MPC controller for a MIMO system and I keep getting the following error.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274532/image.png)
This is my Simulink block diagram:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274533/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274534/image.png)
6 件のコメント
Jonah Embry-Seckler
2020 年 4 月 13 日
Additionally, the exact error appears to occur on line 14 in this line:
mpcobj = slResolve(mpcobjname,blk)
slResolve cannot resolve mpc1. What is slResolve? It doesn't appear to be a standard Matlab function based on my google searches.
Walter Roberson
2021 年 5 月 29 日
slResolve() is probably the internal Simulink symbol resolution; https://www.mathworks.com/help/simulink/ug/resolving-symbols.html
採用された回答
Samuel Folorunsho
2021 年 6 月 8 日
The probelem is that you did not save the mpc controller as a mat file that could be called once you exit the designer. So once you clear your workplace , the exported controller is no longer available on the workplace resulting in the error. To resolve this, you will need to:
- Save the controller after exporting it : save('mpc1.mat','mpc1'). Here mpc1 is the name of the controller as speficied by you while designing it
- Include the code to call the saved controller in your MATLAB file: load('mpc1'). This will load the controller into your workspace and your model will run without the error.
I hope this helps
reference: https://www.mathworks.com/matlabcentral/answers/403735-how-to-save-mpc-model-predictive-controller-to-be-used-later-on-the-error-message-is-attached
1 件のコメント
その他の回答 (3 件)
Wissal Tabib
2021 年 5 月 29 日
did you find a solution to your problem what was it ? I am facing the same
0 件のコメント
Adesola Bankole
2022 年 4 月 23 日
Make sure that the 'clear' or 'clear all' syntax is either commented or deleted.
The issue should be resolved with that action
0 件のコメント
Guilherme Vitor Santos
2022 年 6 月 3 日
編集済み: Guilherme Vitor Santos
2022 年 6 月 3 日
Estous com esse problema no matlab online
Error evaluating 'InitFcn' callback of Audio Device Writer block (mask) 'labtelecom/Audio Device Writer'.
Callback string is 'audioblkAudioDeviceIO(gcbh, 'initfcn');'
Caused by:
No audio input device detected
3 件のコメント
Walter Roberson
2022 年 6 月 8 日
Ashlesh, are you using Chrome to access MATLAB Online? No other browser can possibly work.
参考
カテゴリ
Help Center および File Exchange で Linear Plant Specification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!