I am having problems creating user defined function. Here is the code I used. When I run it, I am keep getting error in line two and Not enough input arguements
2 views (last 30 days)
Show older comments

3 Comments
Rik
on 8 Dec 2021
What value did you assign to k outside of your function? Remember that your function doesn't know anything about the variable names outside of in, and your calling code doesn't know anything about the variable names inside the function.
Answers (1)
Dyuman Joshi
on 8 Dec 2021
Call like this -
[x,y] = torus(1,2) %single input/output
[x,y] = torus([1 2 3], [2 3 4]) %array input/output
or initialize j and k before calling the function
j=1;k=2;
[x,y] = torus(j,k) %single input/output
j=[1 2 3];k=[2 3 4];
[x,y] = torus(j,k) %array input/output
0 Comments
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!