Filter löschen
Filter löschen

vertcat

4 Ansichten (letzte 30 Tage)
ram
ram am 22 Jul. 2011
[EDIT: 20110722 11:00 CDT - reformat - WDR]
I have an array of strings,i would like to display that string in listbox,so i use,
contents = get(hObject,'String')
selectedText = contents{get(hObject,'Value')};
switch selectedText
case'(default)'
set(handles.listbox7,'string',[])
case 'Simply Supported Beam'
set(handles.listbox7,'string',['432';'3234';'534'])
case'Cantilever Beam'
set(handles.listbox7,'string',['436';'768';'3463'])
case 'Truss'
set(handles.listbox7,'string',['324';'886';'435'])
case 'Plate'
set(handles.listbox7,'string',['546';'4534';'576'])
case 'Shear Building'
set(handles.listbox7,'string',['456';'465';'234'])
end
guidata(hObject,handles)
When I do that, I get an error saying:
Error using ==> vertcat
CAT arguments dimensions are not consistent.
Here's a test program that illustrates the problem:
??? Error using ==> Trial1>popupmenu13_Callback at 618
Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> gui_mainfcn at 97
feval(varargin{:});
Error in ==> Trial1 at 43
gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)Trial1('popupmenu13_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol
pls.. help me

Akzeptierte Antwort

Jan
Jan am 22 Jul. 2011
E.g. "['432';'3234';'534']" is not proper. It would create a CHAR matrix like:
['4', '3', '2';
'3', '2', '3', '4';
'5'm '3', '4']
As you see, this is not rectangular. What do you want to appear in the listbox7 object? For a multi-line text use:
{'432';'3234';'534'}
  1 Kommentar
ram
ram am 26 Jul. 2011
thank you jan its working...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks 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