Hi, I just wrote my first Matlab function for a class, and whenever I try to run it by writing 'converttemp(12)' (12 just being a random number), it comes up with
??? Input argument "C" is undefined.
Error in ==> L7T1 at 6
F =((9/5)*C)+32
This is my code for it,
function F=converttemp(C)
%Converts Celcius to Fahrenheit
% The function converts a Celcius value to Fahreneheit, using the equation
% F=((9/5)C)+32
F =((9/5)*C)+32
end
I was really helping someone could let me know where I've gone wrong.
Thanks for any help =)
??? Input argument "C" is undefined.
Error in ==> L7T1 at 6
F =((9/5)*C)+32
This is my code for it,
function F=converttemp(C)
%Converts Celcius to Fahrenheit
% The function converts a Celcius value to Fahreneheit, using the equation
% F=((9/5)C)+32
F =((9/5)*C)+32
end
I was really helping someone could let me know where I've gone wrong.
Thanks for any help =)
-
Guessing it's that you didn't name your .m file the same as your function. If your function is "converttemp" then the .m file should be converttemp.m. Try that and see if it works.