MATLAB: How to append text to the end of an edit text control

appendcontroleditguiMATLABtext;

I am writing a GUI in which a periodically writes to a display area, which I contructed from a multi-line edit uicontrol. I don't know how to append to the end of the existing string

Best Answer

There is not functionality in MATLAB 2011a to append text to the end of the current string of an edit text. The workaround is to get the current string, append the desired text to the end, and then set the exit text to have that string. The following example shows the callback for a pushbutton that adds the string "Appended!" to a new line at the end of the existing edit text.
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
currString= get(handles.edit1,'String')
currString{end+1}='Appended!';
set(handles.edit1,'String',currString);