matlab 函数递归死循环怎么改?
以下是源程序:functionmask=shift2mask(prpoly,shift)error(nargchk(2,2,nargin,'struct'));ifiss...
以下是源程序:
function mask = shift2mask(prpoly, shift)
error(nargchk(2,2,nargin,'struct'));
if isscalar(prpoly)
if (prpoly < 3) % => [1 1]
error(message('comm:shift2mask:InvalidPrpolyParameter'));
end
prpoly = de2bi(prpoly, 'left-msb');
end
if ( ~( isvector(prpoly) && ~isempty(prpoly) && ~isscalar(prpoly) ) | ...
any(prpoly~=1 & prpoly~=0) | prpoly(1)==0 | prpoly(end)==0)
error(message('comm:shift2mask:InvalidPrpoly'));
end
if ( ~isscalar(shift) | ~isreal(shift) | floor(shift) ~= shift )
error(message('comm:shift2mask:ShiftNotScalarInt'));
end
ord = length(prpoly)-1;
if ord > 53
error(message('comm:shift2mask:OrderGreaterThan53'));
end
shift = rem(shift, 2^ord - 1);
if (shift < 0)
shift = shift + 2^ord - 1;
end
% Function call函数调用
mask = shift2mask(prpoly, shift);
出现错误:
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N)
to change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.
Error in shift2mask
求大神指导怎么改?尝试过改 set(0,'RecursionLimit',N)中的N为1000甚至1500,都不行。改1500直接关闭了 展开
function mask = shift2mask(prpoly, shift)
error(nargchk(2,2,nargin,'struct'));
if isscalar(prpoly)
if (prpoly < 3) % => [1 1]
error(message('comm:shift2mask:InvalidPrpolyParameter'));
end
prpoly = de2bi(prpoly, 'left-msb');
end
if ( ~( isvector(prpoly) && ~isempty(prpoly) && ~isscalar(prpoly) ) | ...
any(prpoly~=1 & prpoly~=0) | prpoly(1)==0 | prpoly(end)==0)
error(message('comm:shift2mask:InvalidPrpoly'));
end
if ( ~isscalar(shift) | ~isreal(shift) | floor(shift) ~= shift )
error(message('comm:shift2mask:ShiftNotScalarInt'));
end
ord = length(prpoly)-1;
if ord > 53
error(message('comm:shift2mask:OrderGreaterThan53'));
end
shift = rem(shift, 2^ord - 1);
if (shift < 0)
shift = shift + 2^ord - 1;
end
% Function call函数调用
mask = shift2mask(prpoly, shift);
出现错误:
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N)
to change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.
Error in shift2mask
求大神指导怎么改?尝试过改 set(0,'RecursionLimit',N)中的N为1000甚至1500,都不行。改1500直接关闭了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询