用matlab编写验证魔方矩阵的函数文件,输出要求如下:如果输入矩阵的维数小于3,输出显示’error’。

[复制链接]
查看11 | 回复1 | 2013-1-24 11:55:26 | 显示全部楼层 |阅读模式
试试这样:clear all;clc;n=input(please input the dimension:);if n=3 magic(n)else
fprintf(error);end please input the dimension:4ans =
16
2
3
13
5
11
10
8
9
7
6
12
4
14
15
1please input the dimension:2error赞同0|评论
回复

使用道具 举报

千问 | 2013-1-24 11:55:26 | 显示全部楼层
sfsfsf赞同0|评论
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行