Main Content

hasNextWorkingSet

Class: hdl.WorkingSet
Namespace: hdl

Check whether another working set can be constructed from input image

Since R2024a

Description

example

hasNextWorkingSet() checks whether another working sets can be constructed from the input image. If the another working set can be constructed, hasNextWorkingSet returns true. Otherwise, it returns false.

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]);
    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 hasNextWorkingSet method. It generates the working sets for each pixel of the input image.

image = rand(20, 20);
ws = hdl.WorkingSet(image,[3 3]);
for x = 1:20
    for y = 1:20
        if(hasNextWorkingSet)
            workingSet = ws.getWorkingSet(x, y);
            out = line_buffer_average(workingSet);
        end
    end
end

Note

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

Version History

Introduced in R2024a