MATLAB产生一个信息表 【例】

fprintf(' Table of Square Roots, Squares, and Cubes\n\n');
% Print column headings
fprintf(' Number Square Root Square Cube\n');
fprintf(' ====== =========== ====== ====\n');
% Generate the required data
ii = 1:15;
square_root = sqrt(ii);
square = ii.^2;
cube = ii.^3;
% Create the output array
out = [ii' square_root' square' cube'];
% Print the data
for ii = 1:15
fprintf (' - .4f m �\n',out(ii,:));
end
posted @ 2013-03-12 21:05  dreamsyeah  阅读(138)  评论(0编辑  收藏  举报