diff --git a/ShoulderCase/getTabulatedProperties.m b/ShoulderCase/getTabulatedProperties.m index 56e7484..2ffadde 100644 --- a/ShoulderCase/getTabulatedProperties.m +++ b/ShoulderCase/getTabulatedProperties.m @@ -1,20 +1,22 @@ function output = getTabulatedProperties(object) properties = string(fields(object))'; for property = properties if not(isstring(object.(property)) || isnumeric(object.(property)) || ischar(object.(property)) ) disp(property) continue end if ischar(object.(property)) object.(property) = string(object.(property)); end if numel(object.(property)) == 1 data.(fieldnameToColumnname(property)) = object.(property); end end output = struct2table(data); end function output = fieldnameToColumnname(fieldname) - output = lower(regexprep(fieldname, "[A-Z]", "_$0")); + columnname = (regexprep(fieldname, "[A-Z]{1}", "_${lower($0)}")); + columnname = (regexprep(columnname, "^_", "")); + output = columnname; end \ No newline at end of file