Am new to Matlab.if i use imshow funtion,matlab shows error in the built in function..how can i overcome this problem?

1 view (last 30 days)
Am new to Matlab.if i use imshow function in my program,matlab shows error in the built in function..how can i overcome this problem?
  4 Comments
Steven Lord
Steven Lord on 16 Feb 2018
That doesn't look like the FULL error message. It shows where the problem occurred but not what the problem is. As Guillaume said, show everything in red.
Priya Dharsini
Priya Dharsini on 16 Feb 2018
| _Attempt to execute SCRIPT image as a function: C:\Users\admin\Documents\MATLAB\image.m
Error in images.internal.basicImageDisplay (line 24) hh = image(cdata, ...
Error in imshow (line 293) hh = images.internal.basicImageDisplay(fig_handle,ax_handle,...
Error in hh (line 5) imshow(u);

Sign in to comment.

Answers (1)

Guillaume
Guillaume on 16 Feb 2018
Now that we've got the full error message, it's clear what the problem is.
Rename your image.m script to something else. imshow is trying to use matlab's own image function but because files in your current directory take priority it's calling your image script instead. We say that your script shadows the image function.
Other functions that are commonly shadowed by mistake are sum, mean, table, cell, struct, var, i and j. Don't use these as functions, scripts or variable names.

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!