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

2 次查看(过去 30 天)
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')

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by