How to find indices of array in hdl coder?
Show older comments
I am trying to work on a hdl code using matlab with hdl coder.The matlab code generates it into fixed point code sucessfully but when i try to convert the fixed point code to hdl format,I am facing some issues constantly.The code has part about finding the various indices of an array using if condition in which the error arises.
The error I am getting is:
ErrorFound an unsupported unbounded loop structure, at Function 'ifWhileCond' (#96.698.975), line 31, column 1 Function 'ifWhileCond' (#96.455.469), line 18, column 13 Function 'segmentationHDLdesign_fixpt' (#1.1070.1146), line 32, column 5. This loop may be user written or automatically generated due to the use of specific vector expressions or functions.
Code:
% %columnwise histogram segmentation
for i=1:n
if(image(:,i)==b)
y(i)=i;
end
end
col=zeros(1,322);
k=1;
for i=1:322
if(y(i)==0)
col(k)=i;
k=k+1;
end
end
6 Comments
Walter Roberson
on 25 Feb 2024
if(image(:,i)==b)
It would be clearer if you explicitly coded
if all(image(:,i)==b)
Walter Roberson
on 25 Feb 2024
Maybe
k = 0;
for i = 1:322
if y(i)
k = k + 1;
y(k) = y(i);
y(i) = 0;
end
end
with no col array.
Siddarth S
on 26 Feb 2024
Edited: Siddarth S
on 26 Feb 2024
Walter Roberson
on 26 Feb 2024
Edited: Walter Roberson
on 26 Feb 2024
k = 0;
for i = 1:322
if y(i)
k = k + 1;
if k ~= i
y(k) = y(i);
y(i) = 0;
end
end
end
y = y(1:k);
Siddarth S
on 5 Mar 2024
Edited: Siddarth S
on 5 Mar 2024
Siddarth S
on 5 Mar 2024
Answers (0)
Categories
Find more on Code Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!