source: issm/trunk-jpl/src/m/miscellaneous/structtoobj.py@ 25505

Last change on this file since 25505 was 25505, checked in by jdquinn, 5 years ago

ADD: Missing file

File size: 511 bytes
Line 
1def structtoobj(obj, S):
2 """STRUCTTOOBJ - Convert struct to obj
3
4 NOTE: The following semantics are not Pythonic, but attempt to recreate the
5 same function from MATLAB.
6 """
7
8 # Get object and structure fields
9 structfields = S.__dict__.keys()
10 objprops = vars(obj)
11
12 # Recover object properties
13 for structfield in structfields:
14 if structfield in objprops:
15 fieldvalue = getattr(S, structfield)
16 setattr(obj, structfield, fieldvalue)
17
18 return obj
Note: See TracBrowser for help on using the repository browser.