GUI text box - Replacing a word entered in the text box.

2 ビュー (過去 30 日間)
Zach
Zach 2011 年 5 月 31 日
I have a textbox in my GUI right now and I want the students to input something of the for "10*x(n)" , but for the code to work it has to be "10*x(1)". Is there a way to replace the incoming x(n) with x(1) ?

採用された回答

Matt Fig
Matt Fig 2011 年 5 月 31 日
str = '10*x(n)'
str2 = strrep(str,'n','1')
  2 件のコメント
Zach
Zach 2011 年 5 月 31 日
so if I'm getting it from my text box would it be
str=get(handles.textbox,'string')
str2=strrep(str,'n','1')
Matt Fig
Matt Fig 2011 年 5 月 31 日
That's the idea!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by