Effacer les filtres
Effacer les filtres

change fuction from if to switch statement

1 vue (au cours des 30 derniers jours)
Naomi Penelope
Naomi Penelope le 29 Avr 2020
Commenté : Walter Roberson le 29 Avr 2020
% --- Executes during object creation, after setting all properties.
function sliderText_CreateFcn(hObject, ~, ~)
% hObject handle to sliderText (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%sets the slider value to start at 1
set(hObject,'String', 1);
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
  2 commentaires
Rik
Rik le 29 Avr 2020
What exactly do you want to change? I would suggest not using GUIDE in the first place, but which if do you want to replace with a switch?
If you want to learn more about GUIs in Matlab, I can recommend this thread.
Walter Roberson
Walter Roberson le 29 Avr 2020
%sets the slider value to start at 1
set(hObject,'String', 1);
That is incorrect. String property for a slider is the label, not the value range or current value. The lowest permitted value is controlled by the slider Min property, and the highest permitted value is controlled by the slider Max property, and the current value is controlled by the slider Value property.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by