GUI Matlab Arithmetic Calculator
Mostrar comentarios más antiguos
I have button for numbers but I don't know how to make them display on the editbox. For example, when I press 1, it doesn't get displayed on the editbox and i don't know which function I should be using to have that done.
Respuestas (1)
Walter Roberson
el 16 de Dic. de 2021
Editada: Walter Roberson
el 16 de Dic. de 2021
0 votos
assuming integer inputs
Fetch the current value associated with the edit box. Multiply it by 10, and add the value associated with the key pressed. Set the edit box to that value.
If you are using traditional figures, set the uicontrol edit box 'String' property.
If you are using uifigure, set the uieditfield() 'Value' property; https://www.mathworks.com/help/matlab/ref/uieditfield.html
If you are not assuming integer inputs, then you need to keep track of whether the user has pressed the decimal point yet; if so then you have to keep track of how many digits have been entered after the decimal point, and multiply the new value by the appropraite power of 10.
Categorías
Más información sobre Entering Commands en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!