Conversion to double from struct is not possible.

22 次查看(过去 30 天)
Can you please help me with this error message?
Conversion to double from struct is not possible.
Error in STABLE (line 80)
qs(i,:) = qSol;
Find attached the STABLE.m
This is what i get in the command window:
qSol =
1×7 struct array with fields:
JointName
JointPosition

采纳的回答

Ameer Hamza
Ameer Hamza 2020-5-5
Chage following lines
Line 4:
robot = rigidBodyTree('DataFormat', 'row');
Line 85:
show(robot,qs(1,:));
Line 95
show(robot,qs(i,:),'PreservePlot',false);
  5 个评论
Ameer Hamza
Ameer Hamza 2020-5-6
Do it like this
robot = importrobot('xxxxxxx.urdf');
robot.DataFormat = 'row'; % or 'column'

请先登录,再进行评论。

更多回答(1 个)

Bjorn Gustavsson
Bjorn Gustavsson 2020-5-5
This is obviously an operation that's not supported. If you look at the contens of one struct, you might find that the Jointname is a string, or a char-array. Those might be of different lengths (Al Dee or Vishvanatan Axelsson-Johnsson) - this makes it difficult to convert into a double array. Try with the fields of the struct separately:
Allpos = [qSol(:).JointPosition];
Allnames = char(qSol(:).Jointname)
HTH

类别

Help CenterFile Exchange 中查找有关 Publishers and Subscribers 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by