How to find indices of array in hdl coder?
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 25 Fév 2024
if(image(:,i)==b)
It would be clearer if you explicitly coded
if all(image(:,i)==b)
Walter Roberson
le 25 Fév 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
le 26 Fév 2024
Modifié(e) : Siddarth S
le 26 Fév 2024
Walter Roberson
le 26 Fév 2024
Modifié(e) : Walter Roberson
le 26 Fév 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
le 5 Mar 2024
Modifié(e) : Siddarth S
le 5 Mar 2024
Siddarth S
le 5 Mar 2024
Réponses (0)
Catégories
En savoir plus sur Code Generation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!