its a big problem for me

4 ビュー (過去 30 日間)
ahmed yasin
ahmed yasin 2012 年 4 月 17 日
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

回答 (2 件)

Matt Kindig
Matt Kindig 2012 年 4 月 17 日
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 2012 年 4 月 17 日
You can use regexp() or ismember()

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by