Symphony-DAS / symphony-matlab

Symphony Data Acquisition System
http://symphony-das.github.io
MIT License
19 stars 5 forks source link

Store sweeps across instances of the built in figure handlers #6

Closed cafarm closed 8 years ago

cafarm commented 8 years ago

When you change a protocol property, the figure handlers close (by design). This causes the stored sweep in the builtin handlers to disappear. It would be nice if the stored sweeps stuck around until they were explicitly cleared.

Here is the pattern to store info across figure handlers:

classdef Figure < symphonyui.core.FigureHandler

    methods

        function obj = Figure()
            % Get stored info.
            averages = obj.storedAverages();
        end

        function store(obj)
            % Store some data.
            obj.storedAverages([1 2 3]);
        end

    end

    methods (Static)

        function averages = storedAverages(averages)
            % This method stores means across figure handlers.

            persistent stored;
            if nargin > 0
                stored = averages;
            end
            averages = stored;
        end

    end

end