I am getting an error Undefined function or variable ***. The first assignment to a local variable determines its class.
Afficher commentaires plus anciens
I am getting an error when converting the matlab code to HDL using HDL coder during workflow, "Undefined function or variable 'idx'. The first assignment to a local variable determines its class." and also this error "X must be 'double', 'single', 'logical', or 'char'."
Here is the code
clc
close all;
im=imread('01_h.jpg');
im=imresize(im, [512 512]);
[result, c]=func(im);
imshow(result);
this calls the function
function [color1, centroid] = func(im)
[idx cent]=kmeans(im(:),2,'distance','sqEuclidean','Replicates',3);
color1 = zeros(size(im));
color1(idx==1) = im(idx==1);
end
what should i do to fix it?
1 commentaire
KSSV
le 16 Avr 2018
There is a little correction in func
function [color1, centroid] = func(im)
[idx,centroid]=kmeans(im(:),2,'distance','sqEuclidean','Replicates',3);
color1 = zeros(size(im));
color1(idx==1) = im(idx==1);
end
Réponses (0)
Catégories
En savoir plus sur Speed and Area Optimization 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!