Error in writing function file
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a program ,need to create function file for it,i get error wen i create a function file
path='D:\dataset\'
files=dir(strcat(path,'*.jpg'));
for k=1:numel(files)%numel(files)
file_name=files(k).name;
image_name=strcat(path,file_name);
I=imread(image_name);
I=imresize(I,[256 256]);
size(I)
m = mean(I(:));
I1=double(I);
V = var(double(I(:)));
J = stdfilt(I);
SD = std(double(I(:)));
result=[m V SD];
final_col2{k}=result;
end
save('final_col_new','final_col2');
i wrote function file as
function k=colour1(I)
size(I)
m = mean(I(:));
I1=double(I);
V = var(double(I(:)));
J = stdfilt(I);
SD = std(double(I(:)));
result=[m V SD];
final_col2{k}=result;
end
Undefined function or variable "k".
Error in ==> colour1 at 13
final_col2{k}=result;
Error in ==> new1 at 11
colour1(I)
please help
0 commentaires
Réponses (1)
C.J. Harris
le 5 Jan 2012
Your function specifies 'k' as an output, yet within the function you use it as an input. There set 'k' as an input in addition to 'I'. Also, you need to determine what the output from your function is - is it 'final_col2'?
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!