I have 06 popup menu and I want to get its values to calculate DATE_START and DATE_END
Mostra commenti meno recenti
hi everyone, I have 06 popup menu in GUI and I want to get its values to calculate
date_start = [da,dm,dj];
date_end = [fa,fm,fj];
to use them in a push button
here is the script of each push button sata all
% --- Executes on selection change in d_annee.
function d_annee_Callback(hObject, eventdata, handles)
contents=cellstr(get(hObject,'String'));
popda=contents(get(hObject,'Value'));
da=num2str(cell2mat(popda));
% --- Executes on selection change in d_mois.
function d_mois_Callback(hObject, eventdata, handles)
contents=cellstr(get(hObject,'String'));
popdm=contents(get(hObject,'Value'));
popdm;
if(strcmp(popdm,'Janvier'));
dm='01'
elseif(strcmp(popdm,'Février'));
dm='02'
elseif(strcmp(popdm,'Mars'));
dm='03'
elseif(strcmp(popdm,'Avril'));
dm='04'
elseif(strcmp(popdm,'Mai'));
dm='05'
elseif(strcmp(popdm,'Juin'));
dm='06'
elseif(strcmp(popdm,'Juillet'));
dm='07'
elseif(strcmp(popdm,'Août'));
dm='08'
elseif(strcmp(popdm,'Septembre'));
dm='09'
elseif(strcmp(popdm,'Octobre'));
dm='10'
elseif(strcmp(popdm,'Novembre'));
dm='11'
elseif(strcmp(popdm,'Décembre'));
dm='12'
end
% --- Executes on selection change in d_jour.
function d_jour_Callback(hObject, eventdata, handles)
contents=cellstr(get(hObject,'String'));
popdj=contents(get(hObject,'Value'));
dj=num2str(cell2mat(popdj));
% --- Executes on selection change in f_annee.
function f_annee_Callback(hObject, eventdata, handles)
contents=cellstr(get(hObject,'String'));
popfa=contents(get(hObject,'Value'));
fa=num2str(cell2mat(popfa))
% --- Executes on selection change in f_mois.
function f_mois_Callback(hObject, eventdata, handles)
contents=cellstr(get(hObject,'String'));
popfm=contents(get(hObject,'Value'));
popfm;
if(strcmp(popfm,'Janvier'));
fm='01'
elseif(strcmp(popfm,'Février'));
fm='02'
elseif(strcmp(popfm,'Mars'));
fm='03'
elseif(strcmp(popfm,'Avril'));
fm='04'
elseif(strcmp(popfm,'Mai'));
fm='05'
elseif(strcmp(popfm,'Juin'));
fm='06'
elseif(strcmp(popfm,'Juillet'));
fm='07'
elseif(strcmp(popfm,'Août'));
fm='08'
elseif(strcmp(popfm,'Septembre'));
fm='09'
elseif(strcmp(popfm,'Octobre'));
fm='10'
elseif(strcmp(popfm,'Novembre'));
fm='11'
elseif(strcmp(popfm,'Décembre'));
fm='12'
end
% --- Executes on selection change in f_jour.
function f_jour_Callback(hObject, eventdata, handles)
contents=cellstr(get(hObject,'String'));
popfj=contents(get(hObject,'Value'));
fj=num2str(cell2mat(popfj));
% --- Executes on button press in stat_all.
function stat_all_Callback(hObject, eventdata, handles)
% hObject handle to stat_all (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global dj dm da fj fm fa
handles=guidata(gcbf);
date_start=[da,dm,dj];
date_end=[fa,fm,fj];
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!