When I try to use the function 'magic(n)', Matlab says that the execution of the script magic is not supported

2 ビュー (過去 30 日間)
Anna
Anna 2022 年 10 月 5 日
回答済み: Steven Lord 2022 年 10 月 5 日
M = magic (300)
Execution of script magic as a function is not supported:
/Users/helloooo/Documents/MATLAB/magic.m

回答 (2 件)

Steven Lord
Steven Lord 2022 年 10 月 5 日
Rename the magic.m file that you've created in the /Users/helloooo/Documents/MATLAB folder. It's preventing MATLAB from accessing the magic function included in MATLAB.

Benjamin Thompson
Benjamin Thompson 2022 年 10 月 5 日
If your magic.m file does not have "function" at the top, then it is a script and not a function. Scripts cannot be passed arguments in parenthesis. They would normally share the same workspace as the caller.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by