when defining functions on my matlab 7 version iam getting error!!!

??? function [f d] = add(x) | Error: Function definitions are not permitted at the prompt or in scripts.

 採用された回答

Jan
Jan 2012 年 7 月 12 日
編集済み: Jan 2012 年 7 月 12 日

0 投票

The error message is clear: Functions can be defined inside M-files, when they are functions. You cannot create a function neither in M-scripts (M-files which does not start with "function ...", nor in the command window.
So open the editor to create a function. Then save the file to a user-defined folder, which is included in the path (see pathtool). (The later is not obligatory, but most likely what you want to.)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEnvironment and Settings についてさらに検索

質問済み:

2012 年 7 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by