Main Content

nextWorkingSet

Class: hdl.WorkingSet
Namespace: hdl

Get next working set from input image from last pixel position

Since R2024a

Description

example

nextWorkingSet() returns the next working set from the last pixel position from the input image.

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="Wrap");
    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 nextWorkingSet method. It generates the working sets for each pixel of the input image.

image = rand(20,20);
ws = hdl.WorkingSet(image,[3 3],FillMethod="Wrap");
[ws,workingSet] = ws.nextWorkingSet();
while ws.hasNextWorkingSet()
    out = line_buffer_average(workingSet);
    [ws,workingSet] = ws.nextWorkingSet();
end

Note

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

Version History

Introduced in R2024a