0
votes

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 almost, but I dont know how to load data from m file in Simulink. 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

When I put kuca_podaci (without .m) result is almost the same:

Error evaluating 'InitFcn' callback of block_diagram 'Model'.
Caused by:
Undefined function or variable 'kuca_podaci'.
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?

1

1 Answers

0
votes

Make sure the Simulink model and your script kuca_podaci.m are in the same folder, or on the MATLAB path. The error message is telling you Simulink can't find your script kuca_podaci.m.