This is a static copy of a profile report

Home

getrowcost (Calls: 2, Time: 0.380 s)
Generated 04-Jun-2021 04:11:18 using performance time.
function in file C:\Users\willi\OneDrive\NTNU\Masteroppgave_Ke\Matlab\getrowcost.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
46
if Table.(4)(rows) ~= newshort...
13980.166 s43.8%
43
newshorttable = Table(TF,:);
3600.079 s20.7%
42
TF = (Table.(3) == Table.(3)(r...
3600.070 s18.3%
44
if Table.(6)(rows) <= 3
3600.021 s5.5%
23
if Table.(6)(rows) <= 3
3600.018 s4.7%
All other lines  0.027 s7.0%
Totals  0.380 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
tabular.subsreffunction56920.238 s62.7%
categorical.nefunction13980.018 s4.9%
categorical.eqfunction3880.006 s1.5%
tabular.numArgumentsFromSubscriptfunction7200.001 s0.4%
tabular.heightfunction2940.001 s0.2%
Self time (built-ins, overhead, etc.)  0.115 s30.4%
Totals  0.380 s100% 
Code Analyzer results
Line numberMessage
1Function name 'getrowmostcost' is known to MATLAB by its file name: 'getrowcost'.
5The value assigned to variable 'costweight1' might be unused.
10The value assigned to variable 'mostcost' might be unused.
66The variable 'rowcosts' appears to change size on every loop iteration. Consider preallocating for speed.
69'rowcosts' produces a value that might be unused.
Coverage results
Show coverage for parent directory
Total lines in function71
Non-code lines (comments, blank lines)39
Code lines (lines that can run)32
Code lines that did run32
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
time 
Calls 
 line
   1 
function [rowcosts] = getrowmostcost(Table)
   2 
%UNTITLED2 Summary of this function goes here
   3 
%   Detailed explanation goes here
   4 
%check multible exams at same time
< 0.001 
      2 
   5
costweight1 = 100; 
< 0.001 
      2 
   6
costweight2 = 200; 
      2 
   7
costweight3 = 10; 
   8 

< 0.001 
      2 
   9
rowcosts = []; 
< 0.001 
      2 
  10
mostcost = 0; 
< 0.001 
      2 
  11
for rows = 1:height(Table)     
  12 
    %check if allocated is same as behov
  13 
%     if Table{rows,1} == Table{rows,5}
  14 
%         cost1 = costweight1*1;
  15 
%     else
  16 
%         cost1 = costweight1*0;
  17 
%     end
< 0.001 
    360 
  18
    cost1 = 0; 
  19 
    
  20 
    
  21 
    %check if student want to sit with other student
  22 
    %check if not empty
  0.018 
    360 
  23
    if Table.(6)(rows) <= 3 
  0.016 
    292 
  24
        if Table.(2)(rows) == "" 
< 0.001 
    264 
  25
            cost2 = costweight2*0; 
< 0.001 
     28 
  26
        else 
  0.007 
     28 
  27
            if Table.(4)(rows) == Table.(4)(Table.(2)(rows)) 
< 0.001 
     18 
  28
                cost2 = costweight2*0; 
< 0.001 
     10 
  29
            else 
< 0.001 
     10 
  30
                cost2 = costweight2*1; 
< 0.001 
     28 
  31
            end 
< 0.001 
    292 
  32
        end 
< 0.001 
    360 
  33
    end 
  34 
    
< 0.001 
    360 
  35
    cost3 = 0; 
  36 
    
  37 
    %sjekke etter om studenter sitter på samme rom med andre studenter som
  38 
    %har samme faglærer
  39 
    %øke kostnad på de som ikke sitter sammen med samme faglærer
  40 
    
  41 
    %extract entries with same Faglaerer and same BehovForArbeidsplass
  0.070 
    360 
  42
    TF = (Table.(3) == Table.(3)(rows) & Table.(10) == Table.(10)(rows)); 
  0.079 
    360 
  43
    newshorttable = Table(TF,:); 
  0.021 
    360 
  44
    if Table.(6)(rows) <= 3 
  0.001 
    292 
  45
        for rows2 = 1:height(newshorttable) 
  0.166 
   1398 
  46
            if Table.(4)(rows) ~= newshorttable.(4)(rows2) 
< 0.001 
     88 
  47
                cost3 = cost3 + costweight3*1; 
< 0.001 
   1398 
  48
            end 
< 0.001 
   1398 
  49
        end 
< 0.001 
    360 
  50
    end 
  51 
    
  52 
% gammel versjon for sjekk av samme faglærer
  53 
%     for rows2 = 1:height(Table)
  54 
%         if Table{rows,1} == Table{rows2,1}
  55 
%             if strncmpi(Table{rows,3}, Table{rows2,3}, 10)
  56 
%                 if strncmpi(Table{rows,4}, Table{rows2,4}, 10)
  57 
% 
  58 
%                 else
  59 
%                     cost3 = cost3 + costweight3*1;
  60 
%                 end
  61 
%             end
  62 
%         end
  63 
%     end
  64 
    
  65 
    
< 0.001 
    360 
  66
    rowcosts(rows) = cost1 + cost2 + cost3; 
< 0.001 
    360 
  67
end 
  68 

< 0.001 
      2 
  69
rowcosts; 
  70 

< 0.001 
      2 
  71
end 

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