![]() ![]() The keyword end marks the end of the function body, and theįunction won’t know about any code after end.Ī function can have multiple input and output parameters if required,īut isn’t required to have any of either. That has a single input parameter, ftemp,Īnything following the function definition line is called the body of theįunction. The first line of our function is called the function definition,Īnd it declares that we’re writing a function named fahr_to_kelvin, ![]() ![]() Remember to save your m-files in the current directory. So, you will need to save the above code in a file called The name must start with a letter and cannot contain spaces. The name of that file must be the same as the function defined Function ktemp = fahr_to_kelvin ( ftemp ) %FAHR_TO_KELVIN Convert Fahrenheit to Kelvin ktemp = (( ftemp - 32 ) * ( 5 / 9 )) + 273.15 endĪ MATLAB function must be saved in a text file with a.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |