How to get 'set' not to replace values in a textbox each time it is used.

1 view (last 30 days)
Hello, I am building a GUI from a former properly functioning code. Before I had a number of frintf commands display several outputs into the command window and now I'd like those values to display in a textbox in the GUI. I know that I need to use set and sprintf in order to get these values to display. Alone they are working properly. However, I don't want one output to replace the last each time I set a new value. Does anyone know a way to display all of these values in the textbox without 'set' replacing the previous value each time?

Accepted Answer

Greg
Greg on 11 Oct 2017
You're looking for the word "Append" to describe the behavior you want.
Using set() by itself can only replace all content. If you want to append, you manually create the appended string and set that as the new full content.
old = get(...,'String');
set(...,'String',[old,new]);

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!