diff --git a/Utility functions/Local settings utilities/@MyInstrumentDescriptor/MyInstrumentDescriptor.m b/Utility functions/Local settings utilities/@MyInstrumentDescriptor/MyInstrumentDescriptor.m index 2aabbf4..8e2d51e 100644 --- a/Utility functions/Local settings utilities/@MyInstrumentDescriptor/MyInstrumentDescriptor.m +++ b/Utility functions/Local settings utilities/@MyInstrumentDescriptor/MyInstrumentDescriptor.m @@ -1,69 +1,68 @@ % Class for storing information about local instruments classdef MyInstrumentDescriptor < handle properties (Access = public) name = '' % Identifier that is a MATLAB variable name title = '' % Title displayed in menus control_class = '' % Instrument control class - gui = '' % Gui enabled = true StartupOpts = struct() % Options passed to the class constructor on startup LoggerOpts = struct() % Options for starting a logger with this instrument end methods (Access = public) function this = MyInstrumentDescriptor(varargin) P = MyClassParser(this); processInputs(P, this, varargin{:}); end end methods % If title is not specified, return name function val = get.title(this) if isempty(this.title) val = this.name; else val = this.title; end end function set.name(this, val) assert(isvarname(val), ['Value assigned to ''name'' must ' ... 'be a valid MATLAB variable name.']) this.name = val; end function set.enabled(this, val) % Attempt convertion to logical val = logical(val); assert(islogical(val) && isscalar(val), ['Value assigned ' ... 'to ''enabled'' must be a logical scalar.']); this.enabled = val; end function set.StartupOpts(this, val) assert(isstruct(val), ['Value assigned to ''StartupOpts'''... ' must be a structure.']) this.StartupOpts = val; end function Val = get.LoggerOpts(this) Val = this.LoggerOpts; if ~isfield(Val, 'enabled') Val.enabled = ismethod(this.control_class, ... 'createLogger') && this.enabled; end end function set.LoggerOpts(this, val) assert(isstruct(val), ['Value assigned to ''LoggerOpts''' ... ' must be a structure.']) this.LoggerOpts = val; end end end diff --git a/Utility functions/Local settings utilities/convertInstrumentListToDescriptor.m b/Utility functions/Local settings utilities/convertInstrumentListToDescriptor.m index b605475..04fc8cb 100644 --- a/Utility functions/Local settings utilities/convertInstrumentListToDescriptor.m +++ b/Utility functions/Local settings utilities/convertInstrumentListToDescriptor.m @@ -1,58 +1,52 @@ % Convert structure-based instrument list to a descriptor-based one function NewInstrList = convertInstrumentListToDescriptor(OldInstrList) NewInstrList = MyInstrumentDescriptor.empty(); names = fieldnames(OldInstrList); for i = 1:length(names) EntrStruct = OldInstrList.(names{i}); NewInstrList(i).name = names{i}; try NewInstrList(i).control_class = EntrStruct.control_class; catch ME warning(ME.message) end - try - NewInstrList(i).gui = EntrStruct.gui; - catch ME - warning(ME.message) - end - try NewInstrList(i).title = EntrStruct.menu_title; catch ME warning(ME.message) end try if ~isempty(EntrStruct.interface) NewInstrList(i).StartupOpts.interface = EntrStruct.interface; end catch ME warning(ME.message) end try if ~isempty(EntrStruct.address) NewInstrList(i).StartupOpts.address = EntrStruct.address; end catch ME warning(ME.message) end try if ~isempty(EntrStruct.StartupOpts) opt_names = fieldnames(EntrStruct.StartupOpts); for j=1:lengh(opt_names) NewInstrList(i).StartupOpts.(opt_names{j}) = ... EntrStruct.StartupOpts.(opt_names{j}); end end catch end end end