'InitFcn' callback error

조회 수: 119 (최근 30일)
Mariam Dabbous
Mariam Dabbous 2020년 3월 1일
댓글: Walter Roberson 2022년 6월 8일
I was trying to design and tune a MPC controller for a MIMO system and I keep getting the following error.
This is my Simulink block diagram:
When I right-click and select model properties, callbacks, and 'InitFcn', this is what I get:
  댓글 수: 6
Jonah Embry-Seckler
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
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
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:
  1. 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
  2. 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
Javier Pastor
Javier Pastor 2022년 1월 1일
Thank you very much! I was facing the same problem!

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Wissal Tabib
Wissal Tabib 2021년 5월 29일
did you find a solution to your problem what was it ? I am facing the same

Adesola Bankole
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

Guilherme Vitor Santos
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
Ashlesh
Ashlesh 2022년 6월 8일
I have the same issue ..how can I resolve it?
Walter Roberson
Walter Roberson 2022년 6월 8일
Ashlesh, are you using Chrome to access MATLAB Online? No other browser can possibly work.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Plant Specification에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by