rosgenmsg(folderpath) from custom ros msgs add on causes Index exceeds the number of array elements (0).
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Daniel Levy
el 27 de Mzo. de 2020
Comentada: Cam Salzberger
el 31 de Mzo. de 2020
Hello,
I'm trying to get Matlab to be able to use some custom ROS msgs from a ROS package that follows the required structure has worked in other environments. I've followed the instructions at https://www.mathworks.com/help/ros/ug/create-custom-messages-from-ros-package.html but will get a 'Index exceeds the number of array elements (0).' Error on the rosgenmsg(folderpath)
Any one run into this issue before or is this a bug.
2 comentarios
Dhananjay Kumar
el 30 de Mzo. de 2020
Hey daniel, Can you write the complete error message you see or attach a snip?
Respuesta aceptada
Cam Salzberger
el 30 de Mzo. de 2020
Daniel,
This kind of error message generally comes up (in any MATLAB product) when you are trying to call a function but have shadowed the function name with a variable name. For example, if you do this:
rosgenmsg = 1;
myPath = 'C:\ros';
rosgenmsg(myPath)
MATLAB is trying to index into the variable "rosgenmsg" using the character values in "myPath" as index values. Since 'C' is valued at a larger index than the length of "rosgenmsg", you see this error.
Run this command to see if you have "rosgenmsg" shadowed by a variable name:
which -all rosgenmsg
-Cam
6 comentarios
Cam Salzberger
el 31 de Mzo. de 2020
That's good to know, and hopefully anyone else running into the same issue can find it now. Thanks for posting the answer!
Más respuestas (0)
Ver también
Categorías
Más información sobre Publishers and Subscribers en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!