Please help, I'm trying to make a function but I keep getting major errors and I dont know why.
1 次查看(过去 30 天)
显示 更早的评论
function [y,x]=position(N,IS)
for i=1:N
if IS(i)==1 % checks if ligand is active and give new position
dx=randi([-360,360],1);
dy=randi([-50,50],1);
x(i)=x(i)+dx;
y(i)=y(i)+dy;
end
end
The errors are this
Not enough input arguments.
Error in position (line 4)
if IS(i)==1 % checks if ligand is active and give new position
0 个评论
回答(1 个)
Image Analyst
2023-5-4
Did you assign the input arguments before you called it, liks
N = 5;
IS = ones(N, 1);
[y,x]=position(N,IS)
Probably not. You probably just clicked the green run triangle without sending in any input arguments. You can't do that if input arguments are required. You must assign them and pass them in. You can do this in the command window or a script.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Verification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!