I am developmenting a software using App Designer in Matlab. First, the user input some values in Edit Texts, in App Designer. After this, I send this values to a constructor class called Class_TNT. So, I am trying conect this constructor with another class that I created, called Class_Load (that class have some functions to calculate some parameters). But the Class_Load get the default values of constructor class. It's crazy because when I use the breakpoint in constructor class, all parameters has the values that user input in App Designer. Can you help me? Kind regards, Ana Reis
Here, the public properties in App Designer
properties (Access = public)
plate = [];
tnt = [];
end
Here, the code in Run Button, in App Designer
function RunButton_GeneralPushed(app, event)
% Avaliating parameters
[sup, type_sup, type, nonlinear, negative] = app.Avaliating...
(app.SupportPlate.Value, app.SupportMembrane.Value, ...
app.TypeExplosion.SelectedObject.Text,...
app.NonlinearAnalisys.SelectedObject.Text, ...
app.NegativePhase.SelectedObject.Text);
% Sending values to constructor method
app.plate = Class_Plate...
(sup, type_sup, app.app_a.Value, app.app_beta.Value, ...
app.app_h.Value, app.app_nu.Value, app.app_E.Value, ...
app.app_rho.Value, nonlinear, app.TimeAnalysis.Value);
app.tnt = Class_TNT...
(app.app_W.Value, app.app_Z.Value, type, negative);
Here, the constructor Class_TNT
classdef Class_TNT
properties (SetAccess = public, GetAccess = public)
Z = 0;
W = 0;
type = 0;
negative = 0;
end
methods
function tnt = Class_TNT(W, Z, type, negative, varargin)
if (nargin > 0)
tnt.W = W;
tnt.Z = Z;
tnt.type = type;
tnt.negative = negative;
else
tnt.W = 129.45;
tnt.Z = 27.7;
tnt.type = 1;
tnt.negative = 1;
end
end
end
end
And here, the Class_Load (not totally)
classdef Class_Load < Class_TNT
properties (SetAccess = public, GetAccess = public)
td = 0;
end
methods
function blast = Class_Load(W, Z, type, negative)
blast = blast@Class_TNT();
if (nargin > 0)
blast.W = W;
blast.Z = Z;
blast.type = type;
blast.negative = negative;
end
blast.td = blast.Positive_Time();
end
end
methods
function td = Positive_Time(blast)
Z = blast.Z;
W = blast.W;
type = blast.type;
switch type
case 1
td = 0.001 * ( 2.2064 * Z^3 - 0.3363 * Z^2 - ...
0.5644 * Z + 0.3756 ) * ( W^(1/3) );
case 2
td = 0.001 * ( 4.2668 * Z^3 - 1.9736 * Z^2 + ...
0.132 * Z + 0.2145 ) * ( W^(1/3) );
end
end
end
end