Error in writing function file
19 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
C.J. Harris
2012 年 1 月 5 日
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'?
参考
カテゴリ
Help Center および File Exchange で Workspace Variables and MAT Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!