Problem with my first Matlab function (undefined variable)
Favorites|Homepage
Subscriptions | sitemap
HOME > Engineering > Problem with my first Matlab function (undefined variable)

Problem with my first Matlab function (undefined variable)

[From: ] [author: ] [Date: 11-09-11] [Hit: ]
m. Try that and see if it works.......
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 =)

-
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.
1
keywords: with,undefined,variable,Problem,function,my,first,Matlab,Problem with my first Matlab function (undefined variable)
New
Hot
© 2008-2010 http://www.science-mathematics.com . Program by zplan cms. Theme by wukong .