This is a static copy of a profile report

Home

getneighborsof (Calls: 2, Time: 0.225 s)
Generated 04-Jun-2021 04:11:18 using performance time.
function in file C:\Users\willi\OneDrive\NTNU\Masteroppgave_Ke\Matlab\getneighborsof.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
script9script2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
24
newTable(rowmostcost, 4:6) = T...
1840.076 s33.7%
22
if (Table{row, 6} == Table{row...
3600.075 s33.3%
25
newTable(row, 4:6) = Table(row...
1840.073 s32.2%
27
cellarayoftables{end + 1} = ne...
1840.001 s0.4%
29
end
3600.000 s0.2%
All other lines  0.001 s0.3%
Totals  0.225 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
tabular.subsreffunction10880.127 s56.5%
tabular.subsasgnfunction3680.060 s26.6%
tabular.numArgumentsFromSubscriptfunction7200.001 s0.6%
tabular.heightfunction20.000 s0.0%
Self time (built-ins, overhead, etc.)  0.037 s16.3%
Totals  0.225 s100% 
Code Analyzer results
Line numberMessage
27The variable 'cellarayoftables' appears to change size on every loop iteration. Consider preallocating for speed.
Coverage results
Show coverage for parent directory
Total lines in function31
Non-code lines (comments, blank lines)20
Code lines (lines that can run)11
Code lines that did run11
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
time 
Calls 
 line
   1 
function cellarayoftables = getneighborsof(Table, row)
   2 
%UNTITLED6 Summary of this function goes here
   3 
%   Detailed explanation goes here
   4 

   5 
% returns a cellarray of tables with swapped rows for the row with most
   6 
% cost.
   7 

< 0.001 
      2 
   8
rowmostcost = row; 
   9 

  10 
%mostcost = getmostcost(Table)
  11 

  12 

  13 
%todo: preallocate memory of cell
  14 

< 0.001 
      2 
  15
cellarayoftables = {}; 
  16 

< 0.001 
      2 
  17
for row = 1:height(Table) 
< 0.001 
    360 
  18
    newTable = Table; 
  19 
    %skip the row with the most rowcost
  20 
    %if conditions to check if we only swap same TTK(n) course
  21 
    
  0.075 
    360 
  22
    if (Table{row, 6} == Table{rowmostcost, 6}) 
  23 
        %swap
  0.076 
    184 
  24
        newTable(rowmostcost, 4:6) = Table(row, 4:6); 
  0.073 
    184 
  25
        newTable(row, 4:6) = Table(rowmostcost, 4:6); 
  26 
        
< 0.001 
    184 
  27
        cellarayoftables{end + 1} = newTable; 
< 0.001 
    360 
  28
    end 
< 0.001 
    360 
  29
end 
  30 

< 0.001 
      2 
  31
end 

Other subfunctions in this file are not included in this listing.