Hello friends , whould you help me with this error?

1 次查看(过去 30 天)
clc; close all;
picture=imread('LEAF_0120.jpg');
g=rgb2gray(picture);
subplot(3,3,1),imshow(g),title('original');
pic = edge(g,'sobel');
subplot(3,3,2),imshow(pic),title('sobel');
.......................................................................................................................
Error : Attempt to execute SCRIPT edge as a function

回答(1 个)

Walter Roberson
Walter Roberson 2021-4-28
picture=imread('flamingos.jpg');
g=rgb2gray(picture);
subplot(3,3,1),imshow(g),title('original');
pic = edge(g,'sobel');
subplot(3,3,2),imshow(pic),title('sobel');
... What this tells us is that you accidentally named the file of your code edge.m and so you conflicted with using MATLAB's edge() function.
  2 个评论
eltaf kazemi
eltaf kazemi 2021-4-28
ok thank you ...
but why it dont show me the edge plot?
Walter Roberson
Walter Roberson 2021-4-29
Inside a file named edge.m you asked MATLAB to call edge(g,'sobel') . How is MATLAB to know that that call to edge() was to be a call to the MATLAB edge(), and not an attempt to call your current file edge.m recursively ?

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by