How can I input "function Txy (Z1,Z2,P)" properly?

1 view (last 30 days)
How can I input "function Txy (Z1,Z2,P)" properly?
How can I input "function Txy (Z1,Z2,P)" properly? It says that the error is: Error: Function definition not supported in this context. Create functions in code file.

Answers (2)

Walter Roberson
Walter Roberson on 3 Apr 2020
You have to store the code in a file named Txy.m

Geoff Hayes
Geoff Hayes on 3 Apr 2020
Kalynn - it sounds like you are calling the function from the command line like
>> function Txy (Z1,Z2,P)
The function keyword is used only to declare a function in the Txy.m file. To call this function at the command line, or from a script, or from another function, then you just call it using the function name (in this case Txy) and ensure that you are passing in appropriately defined values for each of the three inputs. For example, I might call this function (at the command line) like
>> Txy(1, 2, 3)
I have no idea what the true input values should be and so am just using 1, 2, 3 as an example.

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!