Maybe this is very simple question for you guys, but I'm trying to write a function in MATLAB that works when having just 2 inputs or more. I have been looking for a solution, but couldn't find exactly what I wanted. It is like this
function myfunction(x1,y1,x2,y2)
plot(x1,y1) %// user just puts x1,y1
%// or
plot(x1,y1,x2,y2) %// user puts x1,y1,x2,y2
end
I want the function to work, when the user just puts x1,y1
as the input, but I also want it to work when the user puts x1,y1,x2,y2
and plot a figure.