App Designer: Temperature Unit Converter (Error using matlab.ui.control.EditField)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Error using matlab.ui.control.EditField/set.Value (line 98)
'Value' must be a character vector or a string scalar.
I am using Matlab app designer to create a unit converter. but i have error ;(
app.Type1 = app.FromDropDown.Value;
if strcmp (app.Type1,'Cesius')==1
if strcmp(app.Type2,'Cesius')==1
app.Tout=app.Tin;
app.OutputTemperatureEditField.Value=app.Tout;
elseif strcmp(app.Type2,'Fshrenheit')==1
app.Tout=app.Tin*(9/5)+32;
app.OutputTemperatureEditField.Value=app.Tout;
elseif strcmp(app.Type2,'Kelvin')==1
app.Tout=app.Tin+273.15;
app.OutputTemperatureEditField.Value=app.Tout;
elseif strcmp(app.Type2,'Rankine')==1
app.Tout=(app.Tin+273.15)*9/5;
app.OutputTemperatureEditField.Value=app.Tout;
end
elseif strcmp(app.Type1,'Fshrenheit')==1
if strcmp(app.Type2,'Cesius')==1
app.Tout=(app.Tin*-32)*5/9;
(error) app.OutputTemperatureEditField.Value=app.Tout;
elseif strcmp(app.Type2,'Fshrenheit')==1
app.Tout=app.Tin;
app.OutputTemperatureEditField.Value=app.Tout;
elseif strcmp(app.Type2,'Kelvin')==1
app.Tout=(app.Tin+459.67)*5/9;
app.OutputTemperatureEditField.Value=app.Tout;
elseif strcmp(app.Type2,'Rankine')==1
app.Tout=app.Tin+459.67;
app.OutputTemperatureEditField.Value=app.Tout;
end
0 Kommentare
Antworten (1)
Avratanu Biswas
am 27 Nov. 2020
Bearbeitet: Avratanu Biswas
am 27 Nov. 2020
Hi,
Please try :
% Use num2str in all the cases
app.OutputTemperatureEditField.Value = num2str(app.Tout);
Cheers
Avra
0 Kommentare
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!