forked from openep/openep-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetIndexFromCartoPointNumber.m
More file actions
50 lines (41 loc) · 1.45 KB
/
Copy pathgetIndexFromCartoPointNumber.m
File metadata and controls
50 lines (41 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function [index] = getIndexFromCartoPointNumber(userdata, pointNumber)
% GETINDEXFROMCARTOPOINTNUMBER Finds the index of the mapping point at the
% point number displayed on the Carto mapping system.
%
% Usage:
% [index] = getIndexFromCartoPointNumber(pointNumber)
% Where:
% userdata - a userdata structure
% pointNumber - a point number (or array of point numbers) as displayed
% on the Carto mapping system
% index - an index (or array of indices) for referencing into the
% data fields within userdata.electric
%
% GETINDEXFROMCARTOPOINTNUMBER Finds the index of the mapping point at the
% point number displayed on the Carto mapping system.
%
% Author: Steven Williams (2020) (Copyright)
% SPDX-License-Identifier: Apache-2.0
%
% Modifications -
%
% Info on Code Testing:
% ---------------------------------------------------------------
% index = getIndexFromCartoPointNumber(userdata, 1)
% ---------------------------------------------------------------
%
% ---------------------------------------------------------------
% code
% ---------------------------------------------------------------
index = [];
for i = 1:numel(pointNumber)
point = ['P' num2str(pointNumber(i))];
T = find(strcmpi(userdata.electric.names, point));
if isempty(T)
index(i) = NaN;
warning(['GETINDEXFROMCARTOPOINTNUMBER: Point ' point ' does not exist'])
else
index(i) = T;
end
end
end