user interface - How to view a more than 1 lines of sentences to uipanel in matlab? -


i wanna view result of "detection" function. in "detection" function there "messeges" variable. function, want sentences in messeges variable can preview in gui esspecially in uipanel.

how it. have made panel design in matlab tag=uipanel1.

[messeges]=detection(handles.citra1); %it's call detection      function. 

here uipanel code..

       hp1=uipanel('position', [100 100 700 500],...        'title','ui panel 1');         set(hp1, [messeges]); 

but cannot display sentences messeges variable panel1 had made before..

there errors messeges this

        ??? error using ==> set         there no 'jumlah pasang pixel yang pada objek 13                  adalah 1000' property in 'uipanel' class.         error in ==> deteksi2citra>pushbutton3_callback @ 124        set(hp1, [messeges]);         error in ==> gui_mainfcn @ 96         feval(varargin{:});          error in ==> deteksi2citra @ 42           gui_mainfcn(gui_state, varargin{:});        error in ==>                @(hobject,eventdata)deteksi2citra('pushbutton3_callback',     hobject,eventdata,guidata(hobject))        ??? error while evaluating uicontrol callback 

i have find rellated topic cannot find solution.

please me..

there 3 major problems code.

  1. you have set a property of an object something in matlab.

    set(object_handle,'propertyname1',propertyvalue1,...    'propertyname2',propertyvalue2...) 

    thus might able write set(hp1, 'string', messages); never set(hp1, [messages]);

  2. uipanel container object, means contain other gui objects. put text or edit (see uicontrol) containing string in uipanel. uipanel not have 'string' property.

  3. the position vector of uipanel normalized default. position values must between 0 , 1. see position vector here more info.

example of putting multi-line text in uipanel:

(note code standalone or self consistent code (unlike guide), can copy , paste code , run in matlab command window.)

str = sprintf('your \n multiline \n string ...');  hp1 = uipanel('title','ui panel 1',...     'position', [.25 .1 .67 .67]);  uicontrol(...     'parent', hp1,...     'style','text',...     'units', 'normalized', 'position', [0 0 1 1],...     'string', str); 

Comments