2014-11-06 1 views
0

내가 그러나 나는이 오류가 무엇입니까 이유를 알고하지 않습니다 내가 테스트 한오류 발생 위치 : dlen = uint32 (0);

Error in mr_lsbpex (line 3) 
dlen = uint32(0) ; 

Output argument "a" (and maybe others) not assigned during call to "E:\path\mr_lsbpex.m>mr_lsbpex" 

을 "dlen = UINT32 (0);" MATLAB enviorment (이 함수 외부)에서 모든게 괜찮 았어.

function a = mr_lsbpex (r, p) 
% extract from an array 
dlen = uint32(0) ; 
s = size (r) ; 

rnd = rand (s(1),s(2)) ; 
rd = 32 ; 
rl = s(2) ; 

for i=1:s(2) 
    if rnd(1,i)<rd/rl 
     d = bitget (round(r(1,i)/p),1); 
     dlen = bitset (dlen,rd,d); 
     rd = rd -1 ; 
    end 
    rl = rl -1 ; 
end 

if (dlen > 10000000) 
    clear a ; 
    return ; 
end 

a = uint8(zeros(dlen,1)) ; 
rd = double(dlen * 8) ; 
rl = double(s(1)*s(2)-s(2)) ; 
for i=2:s(1) 
    for j=1:s(2) 
     if rnd(i,j)<rd/rl 
      d = bitget (round(r(i,j)/p) ,1) ; 
      a = z_set_bit (a,rd,d) ; 
      rd = rd - 1 ; 
     end 
     rl = rl - 1 ; 
    end 
end 
+0

오류는 무엇이라고 말합니까? –

+0

@AnderBiguri 해당 게시물을 편집했습니다 –

답변

2

기억 : 여기 내 코드는 필요 a가에 allways을 을 반환 할!


오류는 특정 줄에는 없지만 "전체"기능 자체에 있습니다.

문제는 Matlab이 a이 생성되지 않을 것이라고 생각합니다. 실제로 어떤 경우에는 생성되지 않을 수도 있습니다.

또한 트릭

a=0; % well, or a=NaN; or whatever you want to return 

에게해야 할 함수의 시작 부분에 다음 줄은하지 clear aif (dlen > 10000000)에 해.

+0

감사합니다. –