vertcat
5 次查看(过去 30 天)
显示 更早的评论
[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
0 个评论
采纳的回答
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'}
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!