0

I am trying to write a function that inputs takes an array i keep getting this error

??? Undefined function or method 'correlation' for input arguments of type 'uint8'.

here is my function code

enter code here
function[] = correlation (images)
array=zeros(10);
for i= 1:10
    for j= 1:10
        if(i ~= j)
            array (i,j)=corr2(images(:,:,i),images(:,:,j));
        end;
    end
end
maxarray=zeros(1,10)
for i= 1:10
    value=1;
    max=array(i,1);
    for j= 2:10
        if(array(i,j) > max)
            max=array(i,j);
            value=j;
        end
    end
    maxarray(i)=value;
end


minarray=zeros(1,10)

for i= 1:10
    min=1;
    for j= 1:10
        if((i~=j) && (array(i,j) < min))
            min=array(i,j);
            value2=j;
        end;
    end
   minarray(i)=value2;
end

maxarray
minarray

enter code here

can any one please help me :) thank you

1 Answer 1

3

You should define the function as

function correlation(images)

It should be either in a separate file named correlation.m or in a file with another function ( it's nested function in this case).

In addition the file should be stored either in a current working directory or in a directory included in MATLAB path.

Read more about MATLAB functions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.