Azzera filtri
Azzera filtri

vertcat

4 visualizzazioni (ultimi 30 giorni)
ram
ram il 22 Lug 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

Risposta accettata

Jan
Jan il 22 Lug 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 Commento
ram
ram il 26 Lug 2011
thank you jan its working...

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by