Operator '*' is not supported for operands of type 'matlab.ui.control.NumericEditField'.
19 views (last 30 days)
Show older comments
when I tried to multiply or add the values of EditField, I got an error "Operator '*' is not supported for operands of type 'matlab.ui.control.NumericEditField'.".
properties (Access = public)
DCVoltage
Current
Temperature
Pwon1
Pwoff
Pwon2
OnGate
OffGate
Inductor
GateResistance
Vg
Vds
Ids
end
methods (Access = public)
function DCVoltageEditFieldValueChanged(app, event)
value=app.DCVoltageEditField;
app.DCVoltage=value;
end
function CurrentEditFieldValueChanged(app, event)
value=app.CurrentEditField;
app.Current=value;
end
function TurnonGatevoltageEditFieldValueChanged(app, event)
value=app.TurnonGatevoltageEditField;
app.OnGate=value;
end
function TurnoffGatevoltageEditFieldValueChanged(app, event)
value=app.TurnoffGatevoltageEditField;
app.OffGate=value;
end
function TemperatureEditFieldValueChanged(app, event)
value=app.TemperatureEditField;
app.Temperature=value;
end
function InductorLEditFieldValueChanged(app, event)
value=app.InductorLEditField;
app.Inductor=value;
end
function GateresistanceEditFieldValueChanged(app, event)
value=app.GateresistanceEditField;
app.GateResistance=value;
end
function PulseEditFieldValueChanged(app, event)
app.PulseEditField_2=value;
value=app.Pwon1;
end
function PulseEditField_2ValueChanged(app, event)
value=app.PulseEditField_2;
app.Pwoff=value;
end
function PulseEditField_3ValueChanged(app, event)
value=app.PulseEditField_3;
app.Pwon2=value;
end
methods (Access = private)
function RunButtonPushed(app, event)
r1=app.DCVoltage;
r2=app.Current;
r3=r1*r2;
app.TurnondelayEditField=r3;
end
function ConfigureButtonPushed(app, event)
CurrentEditFieldValueChanged(app);
DCVoltageEditFieldValueChanged(app);
InductorLEditFieldValueChanged(app);
TemperatureEditFieldValueChanged(app);
GateresistanceEditFieldValueChanged(app);
TurnonGatevoltageEditFieldValueChanged(app);
TurnoffGatevoltageEditFieldValueChanged(app);
m1=app.Inductor;
m2=app.Current;
m3=app.DCVoltage;
m4=(m1*m2)/m3;
app.Pwon1=m4;
app.PulseEditField_2=m4;
PulseEditFieldValueChanged(app);
PulseEditField_2ValueChanged(app);
PulseEditField_3ValueChanged(app);
0 Comments
Accepted Answer
Walter Roberson
on 30 Apr 2023
value=app.CurrentEditField;
All of your lines like that are wrong. app.CurrentEditField is the graphic object that describes a particular edit field; it is not the numeric value contained there. You need to extract the Value property app.CurrentEditField.Value
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!