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 件のコメント

Massimo Lucia
Massimo Lucia 2020 年 5 月 5 日
thank you! It works properly now. Just a matter of rows and columns!
Ameer Hamza
Ameer Hamza 2020 年 5 月 5 日
I am glad to be of help.
Massimo Lucia
Massimo Lucia 2020 年 5 月 6 日
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?
Ameer Hamza
Ameer Hamza 2020 年 5 月 6 日
Do it like this
robot = importrobot('xxxxxxx.urdf');
robot.DataFormat = 'row'; % or 'column'
Massimo Lucia
Massimo Lucia 2020 年 5 月 7 日
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 で Data Types についてさらに検索

製品

リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by