GUI Matlab Arithmetic Calculator

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.

Antworten (1)

Walter Roberson
Walter Roberson am 16 Dez. 2021
Bearbeitet: Walter Roberson am 16 Dez. 2021

0 Stimmen

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.

Kategorien

Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 16 Dez. 2021

Bearbeitet:

am 16 Dez. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by