cchessy 发表于 2009-4-13 21:31:22

中括号的含义?

中括号的含义?
function quickplot(fun,xlim)
msg=nargchk(2,2,nargin);
error(msg);
if (size(xlim,1)==1 & size(xlim,2)==2) | (size(xlim,2)==1 & size(xlim,1)==2)
    n_steps=100;
    step_size=(xlim(2)-xlim(1))/n_steps;
    x=xlim(1):step_size:xlim(2);
    y=feval(fun,x);
    plot(x,y);
    title(['\bfPlot of function' fun '(x)']);
    xlabel('\bfx');
    ylabel(['\bf' fun '(x)']);
else
    error('Incorrect number of elements in xlim.');
end

这个函数中,title(['\bfPlot of function' fun '(x)']);和ylabel(['\bf' fun '(x)']);这两句,为何要加中括号?不加中括号会出错!

moon01984 发表于 2009-4-14 09:44:52

语法规则决定的,就好比是c为啥总从main入口

cchessy 发表于 2009-4-14 12:50:00

等于没说哦

loki0607 发表于 2010-10-11 21:43:48

:shutup:支持~
页: [1]
查看完整版本: 中括号的含义?

招聘斑竹