new general processing structure just before splitting off the projects folder from this repo
68 lines
2.3 KiB
Matlab
68 lines
2.3 KiB
Matlab
classdef Equalizerstruct
|
|
% Equalizerstruct - Class to store and manage equalizer structure data
|
|
|
|
properties
|
|
eq_id (1,1) double {mustBeNumeric} = NaN
|
|
equalizer_structure equalizer_structure = equalizer_structure.ffe
|
|
eq
|
|
mlse
|
|
comment char = string.empty() % Changed to string with proper empty initialization
|
|
hash char = string.empty() % Changed to string with proper empty initialization
|
|
end
|
|
|
|
methods
|
|
function obj = Equalizerstruct(varargin)
|
|
% Constructor method for Equalizerstruct
|
|
% Can be called empty or with name-value pairs
|
|
|
|
if nargin > 0
|
|
for i = 1:2:nargin
|
|
if isprop(obj, varargin{i})
|
|
obj.(varargin{i}) = varargin{i+1};
|
|
else
|
|
error('Property %s does not exist in Equalizerstruct', varargin{i});
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function s = toStruct(obj)
|
|
% Convert the object to a struct
|
|
s = struct();
|
|
props = properties(obj);
|
|
for i = 1:length(props)
|
|
s.(props{i}) = obj.(props{i});
|
|
end
|
|
end
|
|
|
|
function str = toString(obj)
|
|
% Convert the object to a formatted string
|
|
s = obj.toStruct();
|
|
str = sprintf('Equalizerstruct:\n');
|
|
fields = fieldnames(s);
|
|
for i = 1:length(fields)
|
|
val = s.(fields{i});
|
|
if isempty(val)
|
|
str = sprintf('%s%s: []\n', str, fields{i});
|
|
elseif isnumeric(val) && length(val) > 1
|
|
str = sprintf('%s%s: [%s]\n', str, fields{i}, num2str(val'));
|
|
else
|
|
str = sprintf('%s%s: %s\n', str, fields{i}, string(val));
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
methods (Static)
|
|
function obj = fromStruct(s)
|
|
% Create an Equalizerstruct object from a struct
|
|
obj = Equalizerstruct();
|
|
fields = fieldnames(s);
|
|
for i = 1:length(fields)
|
|
if isprop(obj, fields{i})
|
|
obj.(fields{i}) = s.(fields{i});
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end |