How to load data from Simulnik Thermal House example?

조회 수: 2 (최근 30일)
I G
I G 2020년 1월 6일
댓글: I G 2020년 1월 7일
I am trying to make Simulink example Thermal house (https://www.mathworks.com/help/simulink/slref/thermal-model-of-a-house.html) by myself. I did it almpst, but I dont know how to load data from m file. With File - Model Properties - Model Properties- Callbacks - InitFcn, where I put my m file with variables kuca_podaci.m, when I run simulation I got (my file kuca_podaci.m is on the same path where my Model.slx is saved):
Error evaluating 'InitFcn' callback of block_diagram 'Model'.
Caused by:
Undefined variable "kuca_podaci" or class "kuca_podaci.m".
Component: Simulink | Category: Model error
I tried to find some element from Simulink Library Browser, something as input block element from Simulink, but every element has output from it, I dont know where and with what to bind that output?
In tutorial from the beginning of question is not writtern explicitely how they initialized the data. It is only written: "The sldemo_househeat_data.m file initializes data in the model workspace"
Is there some other way to initialize data from m file in Simulink model?

채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 1월 6일
Specify the callback as "kuca_podaci". Don't include the ".m" extension.
  댓글 수: 3
Fangjun Jiang
Fangjun Jiang 2020년 1월 7일
What do you get when running
which -all kuca_podaci
I G
I G 2020년 1월 7일
Solved, I changed Matlab workspace to workspace where kuca_podaci.m file isstored, and I got answer where it is with this question:
which -all kuca_podaci
Now I have different problem, but I guess it is not connected with this?
The "FixedStepDiscrete" solver cannot be used to simulate block diagram 'Model' because it contains continuous states
Component: Simulink | Category: Model error

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by