查看单个帖子
旧 2008-04-23, 11:05   #1
huyanan008
初级会员
 
注册日期: 2008-04-22
年龄: 40
帖子: 7
声望力: 0
huyanan008 正向着好的方向发展
默认 [求助]switch case语句问题

各位大侠好,菜鸟又来求助了,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

谢谢各位大侠的帮助
huyanan008 当前离线   回复时引用此帖