Passing an array into a function

조회 수: 1 (최근 30일)
Rajashree Annapillai
Rajashree Annapillai 2019년 1월 27일
편집: Stephen23 2019년 1월 29일
Let x=[0.7840 0.0005 0.0817 0.5732] .When this array is given in a function as p1= Im_opt(p, x(1), x(2), x(3), x(4)), I get the result as -0.0023 but when I pass the array directly into the function as p1=Im_opt(p, 0.7840, 0.0005, 0.5732), I am getting the result as 0.0033. Why I am getting different value for the same array? Please anyone help me with this.
  댓글 수: 3
Rajashree Annapillai
Rajashree Annapillai 2019년 1월 27일
Im_opt is not a built in function and is used to encrypt the image and to find the correlation between the two images sir.

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

채택된 답변

Jan
Jan 2019년 1월 29일
This is most likely the same problem than in your other question: The statement "Let x=[0.7840 0.0005 0.0817 0.5732]" is not true, but this is only the abbreviated display in the command window. See:
doc format
E.g. the 2nd value might not be "0.0005", but "0.000499", which is displayed identically, although the values differ.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by