File: GetPropertyType.m

package info (click to toggle)
openems 0.0.35%2Bgit20190103.6a75e98%2Bdfsg.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,544 kB
  • sloc: cpp: 40,417; python: 2,028; yacc: 580; makefile: 459; lex: 350; sh: 176; ruby: 19
file content (30 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (3)
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
function type_name = GetPropertyType(CSX, name)
% function type_name = GetPropertyType(CSX, name)
%
% internal function to get the type of a given property
%
% CSXCAD matlab interface
% -----------------------
% author: Thorsten Liebig (c) 2010-2013

if ~ischar(name)
    error('CSXCAD::GetPropertyType: name must be a string');
end
if ~isfield(CSX,'Properties')
    error('CSXCAD:GetPropertyPosition','CSX.Properties is not defined');
end

type_name = '';
if isempty(CSX.Properties)
    return
end

prop_types = fieldnames(CSX.Properties);
for n=1:numel(prop_types)
    for p = 1:numel(CSX.Properties.(prop_types{n}))
        if (strcmp(CSX.Properties.(prop_types{n}){p}.ATTRIBUTE.Name,name))
            type_name = prop_types{n};
            return;
        end
    end
end