This is a static copy of a profile report

Home

cell.setdiff>cellsetdiffR2012a (6 calls, 0.030 sec)
Generated 14-Nov-2016 07:47:21 using cpu time.
subfunction in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/ops/@cell/setdiff.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
cell.setdifffunction6
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
315
d = indSortuAuB <= length(u...
60.010 s33.3%
307
uB = unique(b,'R2012a');
60.010 s33.3%
303
uA = unique(a,order);
60.010 s33.3%
337
end
60 s0%
334
if rowvec
60 s0%
All other lines  0.000 s0.0%
Totals  0.030 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
cell.uniquefunction120.020 s66.7%
Self time (built-ins, overhead, etc.)  0.010 s33.3%
Totals  0.030 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function91
Non-code lines (comments, blank lines)27
Code lines (lines that can run)64
Code lines that did run26
Code lines that did not run38
Coverage (did run/can run)40.62 %
Function listing
time 
calls 
 line
 247 
function [c,ia] = cellsetdiffR2012a(a,b,options)
 248 
% 'R2012a' flag implementation
 249 

 250 
% flagvals = {'rows' 'sorted' 'stable'};
      6 
 251 
if nargin == 2 
      6 
 252 
    order = 'sorted'; 
 253 
else
 254 
    if (options(1) > 0)
 255 
        warning(message('MATLAB:SETDIFF:RowsFlagIgnored'));
 256 
    end
 257 
    if options(3) > 0
 258 
        order = 'stable';
 259 
    else % if options(2) > 0 || sum(options(2:3)) == 0)
 260 
        order = 'sorted';
 261 
    end
 262 
end
 263 

 264 
% Double empties are accepted and converted to empty cellstrs to maintain
 265 
% current behavior.
      6 
 266 
if isequal(class(a),'double') && isequal(a,zeros(0,0)) 
 267 
    a = {};
 268 
end
 269 

      6 
 270 
if isequal(class(b),'double') && isequal(b,zeros(0,0)) 
 271 
    b = {};
 272 
end
 273 

      6 
 274 
if ischar(a) 
 275 
    if isrow(a)
 276 
        a = {a};  %refrain from using cellstr to preserve trailing spaces
 277 
    else
 278 
        a = cellstr(a);
 279 
    end
 280 
end
 281 

      6 
 282 
if ischar(b) 
 283 
    if isrow(b)
 284 
        b = {b};  %refrain from using cellstr to preserve trailing spaces
 285 
    else
 286 
        b = cellstr(b);
 287 
    end
 288 
end
 289 

      6 
 290 
if ~iscellstr(a) || ~iscellstr(b) 
 291 
    error(message('MATLAB:SETDIFF:InputClass',class(a),class(b)));
 292 
end
 293 

 294 
% Determine if A is a row vector.
      6 
 295 
rowvec = isrow(a); 
 296 

 297 
% Convert a and b to columns.
      6 
 298 
a = a(:); 
      6 
 299 
b = b(:); 
 300 

 301 
% Make sure a and b contain unique elements. Only get indices if needed.
      6 
 302 
if nargout <= 1 
  0.01 
      6 
 303 
    uA = unique(a,order); 
 304 
else
 305 
    [uA,ia] = unique(a,order);
 306 
end
  0.01 
      6 
 307 
uB = unique(b,'R2012a'); 
      6 
 308 
[sortuAuB,indSortuAuB] = sort([uA;uB]); 
 309 

 310 
% d indicates the location of matching entries
      6 
 311 
d = find(strcmp(sortuAuB(1:end-1),sortuAuB(2:end)));     
 312 

      6 
 313 
indSortuAuB([d;d+1]) = [];              % Remove all matching entries 
 314 

  0.01 
      6 
 315 
d = indSortuAuB <= length(uA);          % Values in a that don't match. 
 316 

      6 
 317 
if d == 0                   % Force d to be the correct shape when a is  
 318 
    d = zeros(0,1);         % cell(0,0) and b is nonempty.
 319 
end
 320 

 321 
% Find c.
      6 
 322 
if strcmp(order, 'stable')  
 323 
    ndx = sort(indSortuAuB(d));   % Sort indSortuAuB(d) for to maintain 'stable' order.
      6 
 324 
else 
      6 
 325 
    ndx = indSortuAuB(d); 
      6 
 326 
end 
      6 
 327 
c = uA(ndx); 
 328 

 329 
% Find ia.
      6 
 330 
if nargout > 1 
 331 
    ia = ia(ndx);
 332 
end
 333 

      6 
 334 
if rowvec 
 335 
    c = c.';
 336 
end
      6 
 337 
end