error = Index exceeds matrix dimension
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
good day to all matlab users and experts here,
i face some problems at work and hope to have some guidance from you all. i am working on my robotic arm project and i have develop a GUI programme to connect and run two stepper motor (motor 1 and motor 2)
i have succeeded in running motor 1 but motor 2 is not working. When i click the button CONNECT, this error came out:
??? Error using ==> serial.subsref at 137 Index exceeds matrix dimensions.
Error in ==> GUI_xyplotter>connect_m2_Callback at 129 obj2 = obj2(2)
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> GUI_xyplotter at 16 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)GUI_xyplotter('connect_m2_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
can i know what is the problem and how to solve it?..thanks a lot in advance:)
2 commentaires
Réponse acceptée
Walter Roberson
le 10 Mar 2011
instrfind used with a property-value pair returns an array of objects with the desired properties. As one of the properties is the port, in order for the array to have more than one element, there would have to be more than one serial object with that exact port. That seems an unlikely situation, so I do not see why your code assumes that there will be at least two objects returned when you go ahead and access obj2(2) ?
13 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!