f



Error in get_Prefix (line 4) maskTmp = zeros(1,4); Output argument "prefix" (and maybe others) not assigned during call to "C:\Users\Suraj\Desktop\subfolder\get_Prefix.m>get_Prefix". Error in pr

function [prefix] = get_Prefix(inputIP,mask)

maskTmp = zeros(1,4);
    
    
    for i=1:4
        if mask >= 8
            maskTmp(i) = 255;
            mask = mask-8;
        elseif mask ==0
            maskTmp(i) = 0;
        else
            tmp=zeros(1,8);
            tmp(1:mask)=1;
            maskTmp(i) = sum(tmp.*2.^(numel(tmp)-1:-1:0));
            mask=0;
        end
            
    end
    mask=maskTmp;
    
    numIP= convert_IP(inputIP);
    if numIP ~=-1
        prefix = bitand(numIP,mask);
        prefix = convert_IP(prefix);
    end
end

           other file 

function [DNS_set] = prefixList(DNS_set,inputIP,mask,mode)
 


 %LOading of IPList%

 fileName='prefixList.m';
fileID = fopen(fileName,'r');

  
load('DNS_set_2014_03_06_B.mat');

IPList = DNS_set.IPList;

  [prefix] = get_Prefix(IPList,24);
 
prefixMap=DNS_set.prefixMap;
 prefixList = DNS_set.prefixes;
  prefixNumber = size(prefixList,1)+1;

if prefixMap.isKey(prefix)==false
            prefixMap(prefix) = prefixNumber;
            prefixNumber = prefixNumber +1;
            prefixList = [prefixList;{prefix}];
            for i=1:numel(inputIP)                                             
                inputIP{i} =[inputIP{i},zeros(size(inputIP{i},1),1)];
            end
            
  end

 prefixList = DNS_set.prefixList;

   end 


Can you please me why this error occurs?
thanks in advance
0
surajparab945
9/24/2014 11:19:01 AM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
1024 Views

Similar Articles

[PageSpeed] 40

<surajparab945@gmail.com> wrote in message 
news:bf80639e-f4b6-40e3-a8a3-5053cc039fda@googlegroups.com...
>
> function [prefix] = get_Prefix(inputIP,mask)
>
> maskTmp = zeros(1,4);
>
>
>    for i=1:4
>        if mask >= 8
>            maskTmp(i) = 255;
>            mask = mask-8;
>        elseif mask ==0
>            maskTmp(i) = 0;
>        else
>            tmp=zeros(1,8);
>            tmp(1:mask)=1;
>            maskTmp(i) = sum(tmp.*2.^(numel(tmp)-1:-1:0));
>            mask=0;
>        end
>
>    end
>    mask=maskTmp;
>
>    numIP= convert_IP(inputIP);
>    if numIP ~=-1
>        prefix = bitand(numIP,mask);
>        prefix = convert_IP(prefix);
>    end
> end

What does this code do if numIP turns out to be -1? What value is assigned 
to the prefix output variable? What value should be returned to the function 
that called get_Prefix?

*snip*

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
Steven
9/24/2014 1:18:39 PM
Reply: