Borrar filtros
Borrar filtros

change fuction from if to switch statement

1 visualización (últimos 30 días)
Naomi Penelope
Naomi Penelope el 29 de Abr. de 2020
Comentada: Walter Roberson el 29 de Abr. de 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 comentarios
Rik
Rik el 29 de Abr. de 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 el 29 de Abr. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by