I am getting error in edge function like "Attempt to execute SCRIPT edge as a function:" b=edge(img,'canny',0.40); Can someone solve this error?
Show older comments
a=imread('D:\canal images\df.jpg'); imshow(a); title('Original');
img=rgb2gray(a); imshow(img); title('Grayscale');
b=edge(img,'canny',0.40); figure,imshow(b); title('canny');
Answers (1)
Jan
on 12 Dec 2017
This error occurs, if the parent folder of edge.m is the current folder. Try this:
cd(tempdir)
and run the code again. Does it help? If so, remember that it can have strange side-effects, if one of the toolbox folders is the current directory.
4 Comments
Jainee Solanki
on 12 Dec 2017
Try it in the command window and run the code again.
Do you know the debugger? Type this in the command window:
dbstop if error
Then Matlab stops, when the problem occurs and you can check the cause - here by
cd
which edge -all
Then you should see, which edge function is called. And if it is the edge.m in the toolbox folder, this contains the help section as comment only. Note that Matlab prefers an M-file in the current folder before the built-in functions. Therefore changing the current directory to a folder inside matlabroot is a bad idea.
Maybe you have another problem, but this is a likely reason.
Jainee Solanki
on 4 Jan 2018
Jainee Solanki
on 4 Jan 2018
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!