Main Content

currentWorkingSet

Class: hdl.WorkingSet
Namespace: hdl

Get current working set or the last generated working set from input image

Since R2024a

Description

currentWorkingSet() returns the current working set or the last generated working set from the input image.

example

Examples

expand all

Map the working set in1 to the line buffer interface in Cadence® Stratus HLS by using the coder.hdl.interface pragma. Calculate the average of the values in the working set.

function out = line_buffer_average(in1)
    coder.hdl.interface(in1,"Line Buffer",[20, 20],FillMethod="Reflected");
    sum = 0;
    for i = 1:size(in1,1)
        for j = 1:size(in1,2)
            sum = sum + in1(i,j);
        end
    end
    out = sum / numel(in1);
 
end

The MATLAB® test bench demonstrates the usage of the hdl.WorkingSet class and currentWorkingSet method. It generates the working sets for each pixel of the input image.

image = rand(20, 20);
ws = hdl.WorkingSet(image,[3 3],FillMethod="Reflected");
for x = 1:20
    for y = 1:20
        workingSet = ws.currentWorkingSet();
        out = line_buffer_average(workingSet);
    end
end

Note

The hdl.WorkingSet class and the currentWorkingSet method must be used inside the MATLAB test bench.

Version History

Introduced in R2024a