Borrar filtros
Borrar filtros

datepicker error in appdesigner

7 visualizaciones (últimos 30 días)
frankenberry
frankenberry el 25 de Abr. de 2020
Respondida: frankenberry el 28 de Abr. de 2020
I'm receiving the following error for my text area calculation of age from a datepicker:
Error setting property 'ageNEQO' of class 'A_QuestionnairesR3'. Value must be of type matlab.ui.control.TextArea or be convertible to matlab.ui.control.TextArea.
The previous code in a datepicker callback function worked and output the age in the TextArea in the previous version of Matlab.
% Value changed function: DatePicker_DoB
function DatePicker_DoBValueChanged(app, event)
% calculate age
app.DatePicker_DoBValueChanged;
age = app.DatePicker_DoB.Value;
DisplayFormat = 'yyyy-mm-dd';
datenow = datestr(now, DisplayFormat);
ageout = datestr(age - datenow, 'yy');
app.TextArea_ageNEQO.ValueChangedFcn = {ageout, string};
if app.TextArea_ageNEQO == ""
uialert(app.UIFigure, {'You need to enter your', 'date of birth to proceed.'}, 'Error', 'Icon', 'Error');
end
Now, the calculation for age is not working and there is no output except the error message above.
I need to use the datepicker on a tab with its own callback function. How do I call the DatePicker function on that tab?
DoB = date of birth
datenow should give me the date from my laptop.
app.TextArea_ageNEQO is a TextArea to write the result of the calculation for ageout.

Respuesta aceptada

frankenberry
frankenberry el 28 de Abr. de 2020
I was able to get most of the datepicker to work now.
age = app.DatePicker_DoB.Value;
DisplayFormat = 'yyyy-mm-dd'; %
datenow = datestr(now, DisplayFormat); %DisplayFormat
ageout = datestr(age - datenow, 'yy');
app.TextArea_ageNEQO.ValueChangedFcn = {ageout, string};
app.TextArea_ageNEQO.Value = [ageout];
if app.TextArea_ageNEQO.Value == ""
uialert(app.UIFigure, {'You need to enter your', 'date of birth to proceed.'}, 'Error', 'Icon', 'Error');
end

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by