Undefined function or method error

Hi Guys,
I am trying generate a magic square using MATLAB using the following code:
clear
n=input('give input:');
if rem(n,2)~=0
M=odd_magic(n)
elseif rem(n,4)~=0
M=single_even_magic(n)
else
M=double_even_magic(n)
end
I am getting an error called -
Undefined function or method 'double_even_magic' for input arguments of type 'double'.
Kindly help me out in this regard and suggest answers. Thank you.

2 件のコメント

Andreas Goser
Andreas Goser 2012 年 2 月 8 日
Is that: Command line code, a function or a script?
Abhishek
Abhishek 2012 年 2 月 8 日
It is a script.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2012 年 2 月 8 日

0 投票

You do not define odd_magic, single_even_magic, or double_even_magic. I don't think any of those are built-in functions.

1 件のコメント

Abhishek
Abhishek 2012 年 2 月 8 日
Thank you for your reply.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by