Please help, I'm trying to make a function but I keep getting major errors and I dont know why.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 4 Mai 2023
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 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!