How to disable the set method of a class
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Instrument Connection and Communication finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!