필터 지우기
필터 지우기

vertcat

조회 수: 3 (최근 30일)
ram
ram 2011년 7월 22일
[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

채택된 답변

Jan
Jan 2011년 7월 22일
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
ram
ram 2011년 7월 26일
thank you jan its working...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by