Any non-zero real element of input<BR> array X is converted to a logical 1 while zeros in X become logical 0.<BR> Complex values and NaNs cannot be converted to logicals and will<BR> result in a conversion error. logical arrays can also be created<BR> using the creation functions TRUE and FALSE.<BR><BR>这是logic 的 help 中说的<BR><BR>向量中非零元变为逻辑1,0元变为逻辑0。复数和非数不能转变并返回错误。<BR><BR>
所以,你的结果应该是1<BR><BR>运行如下<BR><BR>indx=0.76207239;<BR>indx=[indx 1];<BR>ind=diff(indx);<BR>ind=logical(ind)<BR>Warning: Values other than 0 or 1 converted to logical 1.<BR>ind =<BR> 1