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

1 回表示 (過去 30 日間)
Kalynn Rios
Kalynn Rios 2020 年 4 月 2 日
回答済み: Geoff Hayes 2020 年 4 月 3 日
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.

回答 (2 件)

Walter Roberson
Walter Roberson 2020 年 4 月 3 日
You have to store the code in a file named Txy.m

Geoff Hayes
Geoff Hayes 2020 年 4 月 3 日
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.

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by