The Following is the basic skeleton for my MATLAB program. Each box is a class definition.
Scroll down for the error.

Note: 1. Each Class has a custom constructor
The Error
Undefined function or variable 'Troom'.
Error in ==> wall>wall.wall at 31
function o = wall(Tr)
Error in ==> mainfile at 5
w1 = wall();
This comes when I create an object of Class wall from another file “mainfile”
Question
- Why is this happening?
- Am I getting wrong in the concepts of OOP for Matlab specific?
- How do I resolve this?
Thanks in Advance!
PS: Code
function o = wall()
Tr = o.Troom*2;
o.N = round(1/o.dx) + 1;
o.T = Tr * ones(o.N,1);
o.Tinf = Tr;
o.update_properties();
end
Code 2
classdef wall
properties
dx = 0.01;
dt = 0.4;
L = 0.16;
N;
tlimit = 1505.2;
sbc = 5.670400e-8 % The Stefan-Boltzmann Constant
a;
hi; % Surface Conductivity of Inner Surface
bi;
ho; % Surface Conductivity of Outer Surface
bo;
lamb;
Troom = 298; % Room Temperature (K)
Tinf;
T;
room = compartment();
conc = concrete();
fire = fireProperties(Troom);
end
Yeah, there’s your problem right there. Troom can’t be used in the context of the
propertiesblock. Either put the constant in for Troom or move these into the constructor where they belong.