Getitng error suggesting that I should "Use rotate(app, ...) to call this function.". How should I format my code?

1 回表示 (過去 30 日間)
Dev Chhatbar
Dev Chhatbar 2022 年 8 月 5 日
回答済み: Jan 2022 年 8 月 5 日
Hi,
This is what my code for the function "Rotate" looks like:
The error I get here is: Use app as the first argument for 'rotate'.
function o = rotate(centre, verts, theta)
R = [cosd(theta) -sind(theta) cosd(theta)];
c = centre - vertsl
c = c*R;
o = centre + c;
end
I get an error suggesting that I should "Use rotate(app, ...) to call this function.". How can I fix this? It's not running.
This is what the code looks when I call it under the callback function of the buttton:
% Do the rotation of the circles
verts = rotate(root, verts, theta);
sc1_loc = rotate(root, [root(1) + h, root(2)], theta);
sc2_loc = rotate(root, [root(1) - h, root(2)], theta);
bc1_loc = rotate(root, [root(1), root(2) + k], theta);
bc2_loc = rotate(root, [root(1), root(2) - k], theta);
sc1_loc_straight = rotate(root, [root(1) + h, root(2)], 0);
sc2_loc_straight = rotate(root, [root(1) - h, root(2)], 0);
bc1_loc_straight = rotate(root, [root(1), root(2) + k], 0);
bc2_loc_straight = rotate(root, [root(1), root(2) - k], 0);
I am very new to using Matlab so please excuse any inconveniences caused.
Thanks.

回答 (1 件)

Jan
Jan 2022 年 8 月 5 日
Use another name for your function.

カテゴリ

Help Center および File ExchangeGeneral Physics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by