Conversion to double from struct is not possible.

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일

0 개 추천

Chage following lines
Line 4:
robot = rigidBodyTree('DataFormat', 'row');
Line 85:
show(robot,qs(1,:));
Line 95
show(robot,qs(i,:),'PreservePlot',false);

댓글 수: 5

thank you! It works properly now. Just a matter of rows and columns!
I am glad to be of help.
I get the same error when in the same file i replace the line 4 with the following:
robot = importrobot('xxxxxxx.urdf');
How can i set the dataformat to row or column in this case?
Do it like this
robot = importrobot('xxxxxxx.urdf');
robot.DataFormat = 'row'; % or 'column'
got it

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2020년 5월 5일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Publishers and Subscribers에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 5월 5일

댓글:

2020년 5월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by