its a big problem for me

1 visualización (últimos 30 días)
ahmed yasin
ahmed yasin el 17 de Abr. de 2012
hi all ,please i want a help , i want to build a simple calculator in matlab , but the problem that the supervisor need the text editor to accept an expression like 5+3-2*4 and the click in the equal button to determine it , so the proble how can I split this expression for example to deal with it , any help please

Respuestas (2)

Matt Kindig
Matt Kindig el 17 de Abr. de 2012
Well the easiest way would be using eval, like
str = '5+3-2*4'; %the text field
answer = eval(str); %when you click the equals button.
Is this allowed?

Walter Roberson
Walter Roberson el 17 de Abr. de 2012
You can use regexp() or ismember()

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by