huyanan008
2008-04-23, 11:05
各位大侠好,菜鸟又来求助了,switch -case-otherwise-end语句中的条件语句可以用逻辑表达式表示吗,比如
function ifzero(x)
switch x
case x>0
fprintf('%d is p\n',x)
case x<0
fprintf('%d is n\n',x)
otherwise
fprintf('%d is z\n',x)
end
为什么ifzero(8)的结果是8 is z
谢谢各位大侠的帮助
function ifzero(x)
switch x
case x>0
fprintf('%d is p\n',x)
case x<0
fprintf('%d is n\n',x)
otherwise
fprintf('%d is z\n',x)
end
为什么ifzero(8)的结果是8 is z
谢谢各位大侠的帮助