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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 General Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by