フィルターのクリア

Can I automatically regconize function call and execute it in editbox of a GUI.

2 ビュー (過去 30 日間)
Hienbn
Hienbn 2014 年 5 月 16 日
回答済み: Hienbn 2014 年 5 月 17 日
Dear All,
I have several functions such as: add1(a,b)= a*b -a; ...addn(a,b), I want to make an application with GUI, which includes an editbox and a textbox. In the editbox I can write a series of command functions :add1(a,b),.. addn(a,b) and show the result in the text box. For example I write in the editbox: add1(5,3); add4(2,3);add3(1,2)... And program will execute those functions and display the result. In this case do I have to analyze the written text to analyze which function is called, and read its parameter one by one? Summary, I want my edit box has character like the command line of MATLAB, is it possible? or do you have any suggestions for me? Thank you so much.
  1 件のコメント
Yao Li
Yao Li 2014 年 5 月 16 日
The example is doable. ";" can be the delimiter for your callback function.

サインインしてコメントする。

採用された回答

Hienbn
Hienbn 2014 年 5 月 17 日
Yes,eval or evalin is the point. Thank you so much.

その他の回答 (1 件)

Yao Li
Yao Li 2014 年 5 月 16 日
  1. Find the location of ";" by using the command strfind
  2. Seperate the functions (ie. you need to run add1(5,3) first, then add4(2,3))
  3. Execute the function by using the command eval or evalin
  4. Covert the result to a string type array/cell/structure
  5. Display the results

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by