Filter löschen
Filter löschen

change fuction from if to switch statement

1 Ansicht (letzte 30 Tage)
Naomi Penelope
Naomi Penelope am 29 Apr. 2020
Kommentiert: Walter Roberson am 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 Kommentare
Rik
Rik am 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 am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by