
Getting multiple outputs on a single variable in MATLAB function block inside simulink.
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Kiran Kintali
am 30 Jun. 2021
Use this example to see how to extract a port of the image to stream into DUT suitable for HDL Code Generation.

Siehe auch
Kategorien
Mehr zu Speed Optimization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!