How to disable the set method of a class

4 visualizaciones (últimos 30 días)
Collin Smith
Collin Smith el 12 de Feb. de 2018
Hello,
Is it possible to temporarily disable a set method defined within a class?
For example, say I am communicating with an external instrument. To make this easier, I would like to have a class that handles all the communication code for me. This is an example of the class:
classdef InstrumentCommunicatorinator
properties
sample_length = 1e6;
end
methods
function obj = set.sample_length(obj,value)
obj.sample_length = value;
% Lines of code to set sample_length value on external instrument
end
end
end
This works well. Now when I set
InstrumentCommunicatorinator.sample_length = 100;
both my class and my instrument will by in sync, and have a sample length of 100.
However, say I want to make a bunch of settings by hand on the instrument, and transfer these settings FROM the instrument TO the InstrumentCommunicatorinator class. This is a case of when I want to assign values but NOT use the set function I defined. Is it possible to temporarily disable the set method in a class? Or is there a better way of doing this?
Thanks for the help!

Respuestas (0)

Categorías

Más información sobre Instrument Connection and Communication en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by