summaryrefslogtreecommitdiff
path: root/CSXCAD/matlab/AddPropAttribute.m
diff options
context:
space:
mode:
Diffstat (limited to 'CSXCAD/matlab/AddPropAttribute.m')
-rw-r--r--CSXCAD/matlab/AddPropAttribute.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/CSXCAD/matlab/AddPropAttribute.m b/CSXCAD/matlab/AddPropAttribute.m
new file mode 100644
index 0000000..05408f9
--- /dev/null
+++ b/CSXCAD/matlab/AddPropAttribute.m
@@ -0,0 +1,24 @@
+function CSX = AddPropAttribute(CSX, name, att_name, att_value)
+% CSX = AddPropAttribute(CSX, name, att_name, att_value)
+%
+% Add a given attribute (name and value) to the given property
+%
+% CSXCAD matlab interface
+% -----------------------
+% author: Thorsten Liebig (c) 2013
+
+type = GetPropertyType(CSX, name);
+
+pos=0;
+for n=1:numel(CSX.Properties.(type))
+ if strcmp(CSX.Properties.(type){n}.ATTRIBUTE.Name, name)
+ pos=n;
+ end
+end
+
+if (pos==0)
+ error('CSXCAD::AddPropAttribute: property not found');
+ return;
+end
+
+CSX.Properties.(type){pos}.Attributes.ATTRIBUTE.(att_name) = att_value;