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

1 Ansicht (letzte 30 Tage)
Kalynn Rios
Kalynn Rios am 2 Apr. 2020
Beantwortet: Geoff Hayes am 3 Apr. 2020
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.

Antworten (2)

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

Geoff Hayes
Geoff Hayes am 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.

Kategorien

Mehr zu Entering Commands finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by