release

System object: dsp.TimeScope
Package: dsp

Allow property value and input characteristics changes

Syntax

release(H)

Description

release(H) releases system resources, such as memory, file handles, and hardware connections. This method lets you change any properties or input characteristics.

You should call the release method after calling the step method when there is no new data for the simulation. When you call the release method, the axes will automatically scale in the Time Scope figure window. After calling the release method, any nontunable properties can be set once again.

    Note:   You can use the release method on a System object™ in code generated from MATLAB®, but once you release its resources, you cannot use that System object again.

Examples

View a sine wave on the time scope. When you finish the simulation, release system resources. Note that when you run the release method, the axes automatically scale.

hsin = dsp.SineWave('Frequency',100, 'SampleRate', 1000);
hsin.SamplesPerFrame = 10;

hts1 = dsp.TimeScope('SampleRate', hsin.SampleRate,'TimeSpan', 0.1);
for ii = 1:10
     x = step(hsin);
     step(hts1, x);
end

release(hts1);

View two sine waves with different sample rates and time offsets. When you finish the simulation, release system resources. Note that when you run the release method, the axes automatically scale.

Fs = 1000;  % Sampling frequency

hsin1 = dsp.SineWave('Frequency',50,...
   'SampleRate',Fs, ...
   'SamplesPerFrame', 100);

% Create FIRDecimator System object to decimate by 2
hfilt = dsp.FIRDecimator;

% Create TimeScope System object with 2 input 
% ports (channels)
hts2 = dsp.TimeScope(2, [Fs Fs/2], ...
   'TimeDisplayOffset', [0 38/Fs], ...
   'TimeSpan', 0.25, ...
   'YLimits',[-1 1], ...
   'LegendSource', 'Auto');

for ii = 1:2
     xsine = step(hsin1);
     xdec = step(hfilt,xsine);
     step(hts2, xsine, xdec);
end

release(hts2);

Algorithms

In operation, the release method is similar to the mdlTerminate function.

Was this topic helpful?