Here is a snippet of my code:
clc;
figure
x=[30.423 32.562 33.356 34.892];
x1=[30.63 32.822 33.556 34.893];
x2=[30.83 32.962 33.856 34.895];
y=[0.004 0.003 .002 .001];
axis([20 45 1 4])
plot(y,x,'-bo',y,x1,'g-*',y,x2,'-k^','linewidth',1.5,'markeredgecolor','r')
xlimit=[20 40];
xlabel ('Noise level(salt & pepper)');
ylabel ('PSNR');
legend('plain image','cipher image');
It shows output as this error when it hits line 54 of my code:
Error using legend (line 278)
Attempt to execute SCRIPT flip
as a function:
C:\Matlab\bin\R2020a\bin\matlab\flip.m
Error in entropy_graph (line 54)
legend('plain image','cipher
image');

댓글 수: 2

Les Beckham
Les Beckham 2021년 8월 14일
편집: Image Analyst 2021년 8월 14일
Can you tell us what you see if you type this command at the Matlab prompt?
which -all flip
I suspect that you have created a script called flip.m that is somewhere on your path (probably in C:\Matlab\bin\R2020a\bin\matlab\flip.m where there is normally no flip), or in the current working directory. You should rename it since flip is a Matlab function and (apparently) is used by the legend function.
Parveiz Lone
Parveiz Lone 2021년 8월 15일
thanks a lot, i delete the file and create a new file with a different name it works

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 15일

0 개 추천

C:\Matlab\bin\R2020a\bin\matlab\flip.m
Is not a flip.m supplied by Mathworks. flip is a built-in in your version, with a typical "which" location of
C:\Program Files\MATLAB\R2020a\toolbox\matlab\elmat\flip
You might need to reinstall MATLAB completely.

추가 답변 (1개)

Image Analyst
Image Analyst 2021년 8월 14일

0 개 추천

I just copied and pasted and it works fine:
clc;
figure
x=[30.423 32.562 33.356 34.892];
x1=[30.63 32.822 33.556 34.893];
x2=[30.83 32.962 33.856 34.895];
y=[0.004 0.003 .002 .001];
axis([20 45 1 4])
plot(y,x,'-bo',y,x1,'g-*',y,x2,'-k^','linewidth',1.5,'markeredgecolor','r')
xlimit=[20 40];
xlabel ('Noise level(salt & pepper)');
ylabel ('PSNR');
legend('plain image','cipher image');
The error must lie somewhere in the intervening 50 lines you did not show us.

카테고리

제품

릴리스

R2020a

질문:

2021년 8월 14일

댓글:

2021년 8월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by