Effacer les filtres
Effacer les filtres

vertcat

3 vues (au cours des 30 derniers jours)
ram
ram le 22 Juil 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

Réponse acceptée

Jan
Jan le 22 Juil 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 commentaire
ram
ram le 26 Juil 2011
thank you jan its working...

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by