How can i make a matlab function that ll take as entrance two matricies A and B

How can i make a matlab function1 that ll take as entrance two matricies A and B and give us out1:the places where A and B have the same number,out2:the numbers that are same in A and B.

 Accepted Answer

Use the FIND function

6 Comments

out1=find(A==B)? i cant find how to write out2 :/ sorry bout i am new in matlab
Or if you want 2D coordinates
[i,j,out2]=find(A==B);
out1=[i,j];
how can i make a function that accepts as input a vector of integers, which will return the largest and the second largest component of the vector for the first i think that is max1=max(max(C)) any idea for max2?
It is more efficient to do
max1=max(C(:));
Also, as a hint to the second part
C(C==max1)=-inf

Sign in to comment.

More Answers (0)

Asked:

on 18 Nov 2012

Community Treasure Hunt

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

Start Hunting!