How do you make the percentage button work on a basic calculator
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Alejandro Mandujano
el 29 de Mzo. de 2022
Comentada: Alejandro Mandujano
el 31 de Mzo. de 2022
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
0 comentarios
Respuestas (1)
Geoff Hayes
el 31 de Mzo. de 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);
Ver también
Categorías
Más información sobre Data Import and Analysis 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!