How To Get Data From ValueChangedFcn in an Uidatepicker?
이전 댓글 표시
Hi, Community,
I have a problem to get data value from ValueChangedFcn properties... So i have functions below :
dating_timing_original = datetime vector...
cals = datetime(dating_timing_original, 'InputFormat', 'yyyy-MM-dd HH:mm:ss', 'Format', 'yyyy-MM-dd');
mydateapp(cals);
function ff = mydateapp(cals)
fig = uifigure('Position',[200 300 400 300]);
d = uidatepicker(fig,'DisplayFormat','yyyy-MM-dd',...
'Position',[130 190 152 30],...
'Value',min(cals),...
'Limits', [min(cals) max(cals)],...
'ValueChangedFcn', @datechange);
outs = d.ValueChangedFcn;
ff = outs;
function [outs] = datechange(src, event)
% fig2 = uifigure('Position',[130 190 150 22]);
lastdate = char(event.PreviousValue);
newdate = char(event.Value);
if newdate == lastdate
newdate = lastdate
end
% msg = ['Change date from ' lastdate ' to ' newdate '?'];
% Confirm new date
% selection = uiconfirm(fig2,msg,'Confirm Date');
outs = string(datetime(newdate, 'Format', 'yyyy-MM-dd HH:mm:ss'));
src.ValueChangedFcn = outs;
How to get 'ValueChangedFcn' data as an output of mydateapp(cals) function so i can get the value of datetime data as result of clicked calendar (uidatepicker).... Thank you everyone...
댓글 수: 2
Geoff Hayes
2022년 4월 1일
@Tyann Hardyn - can you add some more details on how the above code is to be used? Do you have a GUI (if so, was it designed with App Designer, GUIDE, programmatically?) or are you using a script or function to do some work?
Tyann Hardyn
2022년 4월 2일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!