1%{ @file sn_set_service_batch.m
2 % @brief Sets service rates
for multiple station-
class pairs
4 % @author LINE Development Team
8 % @brief Sets service rates
for multiple station-
class pairs
11 % Batch update of service rates. NaN values are skipped (not updated).
12 % More efficient than calling sn_set_service multiple times.
16 % sn = sn_set_service_batch(sn, rates)
17 % sn = sn_set_service_batch(sn, rates, scvs)
18 % sn = sn_set_service_batch(sn, rates, scvs, autoRefresh)
23 % <tr><th>Name<th>Description
24 % <tr><td>sn<td>Network structure
25 % <tr><td>rates<td>Matrix of
new rates (nstations x nclasses), NaN = skip
26 % <tr><td>scvs<td>Matrix of
new SCVs (optional)
27 % <tr><td>autoRefresh<td>If
true, refresh process fields (
default false)
32 % <tr><th>Name<th>Description
33 % <tr><td>sn<td>Modified network structure
36function sn = sn_set_service_batch(sn, rates, scvs, autoRefresh)
42if nargin < 4 || isempty(autoRefresh)
49% Track updated pairs
for auto-refresh
55 if ~isnan(rates(i, j))
56 sn.rates(i, j) = rates(i, j);
57 updatedPairs = [updatedPairs; i, j]; %#ok<AGROW>
62% Update SCVs
if provided
67 sn.scv(i, j) = scvs(i, j);
73% Auto-refresh if requested
75 for idx = 1:size(updatedPairs, 1)
76 sn = sn_refresh_process_fields(sn, updatedPairs(idx, 1), updatedPairs(idx, 2));