Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Zach
Zach am 31 Mai 2011
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) ?

Akzeptierte Antwort

Matt Fig
Matt Fig am 31 Mai 2011
str = '10*x(n)'
str2 = strrep(str,'n','1')
  2 Kommentare
Zach
Zach am 31 Mai 2011
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 am 31 Mai 2011
That's the idea!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by