How do you make the percentage button work on a basic calculator

1 visualizzazione (ultimi 30 giorni)
Hi. I'm making a calculator on MATLAB and wondering how to get the percentage button to work like on a regular calculator that when upon pressed it converts it into a decimal. Here is the only thing I have so far. Note, I'm in Mexico that's why some words are in spanish:
dato =strcat(app.BResultado.Value, '%');
app.BResultado.Value=dato;
BResultado is what's displayed on screen

Risposte (1)

Geoff Hayes
Geoff Hayes il 31 Mar 2022
@Alejandro Mandujano - don't you just want to divide the number by 100? So (assuming your BResultado is a text (not numeric) field, then you would do something like
dato = str2double(app.BResultado.Value);
dato = dato / 100.0;
app.BResultado.Value = num2str(dato);

Categorie

Scopri di più su Data Import and Analysis in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by