Getting multiple outputs on a single variable in MATLAB function block inside simulink.
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello.
I'm trying to create a simple MATLAB function block that takes an input 2D matrix (image), and extracts all the rows from this image, outputting them one-by-one into the rest of the simulink model for row-based processing (model to go through HDL coder for FPGA implementation at the end). The problem is that when this is being run inside of simulink, only the last row is being outputted to the rest of the pipeline. How can I fix this function such that it outputs the first row for a bit, then the second row for a bit and so on. I've tried delay blocks in Simulink but I think the modification needs to be done within this MATLAB function block .This is what I have currently:
function row_out = row_extractor(img_dat, start, nrows, ncols)
persistent row_inter;
if isempty(row_inter)
row_inter = uint32(zeros(1, ncols));
end
persistent row_dat;
if isempty(row_dat)
row_dat = uint32(zeros(1, ncols));
end
row_out = uint32(zeros(1, 3));
if start == true
for row_index = 1 : nrows
for pixel_index = 1 : ncols
row_dat(pixel_index) = img_dat(row_index, pixel_index);
row_out(pixel_index) = row_dat(pixel_index);
%pause(1);
end
end
end
end
댓글 수: 0
답변 (1개)
Kiran Kintali
2021년 6월 30일
Use this example to see how to extract a port of the image to stream into DUT suitable for HDL Code Generation.
참고 항목
카테고리
Help Center 및 File Exchange에서 HDL Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!