Azzera filtri
Azzera filtri

change fuction from if to switch statement

1 visualizzazione (ultimi 30 giorni)
Naomi Penelope
Naomi Penelope il 29 Apr 2020
Commentato: Walter Roberson il 29 Apr 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 Commenti
Rik
Rik il 29 Apr 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 il 29 Apr 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by