|
Hello Everybody;
I came across an interesting issue and couldn't figure it out after reading all the blog postings and I was wondering whether you could give me any hints.
It is a very simple function call: Input variable is 'x' and as you can see select the output depending on the value of 'x'
function [pinkCar yellowCar whiteCar blueCar greenCar]=newCar(x)
if x==2; pinkCar=100;
elseif x==3; yellowCar=100;
elseif x==4; whiteCar=100;
elseif x==5; blueCar=100;
elseif x==6; greenCar=100;
end
end
When I call this function to the main program the execution of the program terminate with the following error message.
Error in ==> newCar at 2
??? Output argument "pinkCar" (and
maybe others) not assigned during
call to
"C:\Users\root\Documents\MATLAB\newCar.m>newCar".
Error in ==> testSelectCar5 at 79
[pinkCar1 yellowCar1 whiteCar1
blueCar1 greenCar1]=newCar(x1);
??? Input argument "x" is undefined.
Error in ==> newCar at 3
if x==2; pinkCar=100;
Any help I would really appreciate.
Regards;
Gamini
|