Reading cell array strings into GUI edit text box

3 Ansichten (letzte 30 Tage)
Stephen
Stephen am 11 Dez. 2014
Kommentiert: Stephen am 12 Dez. 2014
Quite a simple question today:
I've got a fairly basic GUI with an edit text box. I've got one main block of code in my push button callback. The code produces a cell array of strings and using a loop at the end of the code I want to populate the edit text box with each row respectively of the cell.
So far I have this at the end of my push button callback (could be in completey wrong place)
for zz=1:length(matchescell)
message=matchescell{zz,1};
set(handles.edit10, 'String',message);
end
The only function this has at the moment is to remove the existence of the box on the GUI. I know I'm doing something fundamentally wrong here, there's not much info around looping cell array data into GUIs.
EDIT: I've worked out that the formatting in the strings (line breaks \n) are causing it to not work. I've split the lines up into different columns, so now I need to tell it to do something like this:
set(handles.edit10, 'String',matchescell{v,1} sprintf('\n') matchescell{v,2});
  1 Kommentar
Geoff Hayes
Geoff Hayes am 11 Dez. 2014
Stephen - try avoiding the loop altogether and just set the string with the cell array, ensuring that your edit text box has multiline enabled.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Geoff Hayes
Geoff Hayes am 12 Dez. 2014
Stephen - a very simple example would be to set the edit10 text control to multiline and then try the following example in the button callback
msg = {'hello', 'goodbye', 'seeya', 'ciao'};
set(handles.edit10,'String',msg);
and all four strings will appear one after the other in the control.

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data 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