Magic square (( please help))
1 回表示 (過去 30 日間)
古いコメントを表示
Hi how can I put conditions for magic square such as even or odd or be in MK+1 Form thank you
0 件のコメント
回答 (1 件)
KALYAN ACHARJYA
2022 年 10 月 28 日
編集済み: KALYAN ACHARJYA
2022 年 10 月 28 日
result=2*magic(3)
You have to look for any such possibility for odds too.For any random function or fixed values too, checking data using iteration is not an good idea as per my understanding. Note that magic generates the same values.
Like:
>> data=magic(3)
data =
8 1 6
3 5 7
4 9 2
>> result=double(mod(data,2)==0)+data
result =
9 1 7
3 5 7
5 9 3
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!