Comparing elements of matrix of different Sizes dimension in Matlab
Show older comments
Can anybody help me to find out the method to compare the elements of different sized matrix in Matlab ?
I have one matrix A (100×10) with random elements.
The second array has some of elements which are in matrix B (1×10) with random elements.
Let's say element of matrix A(i,j) and B(i,j) is element of B.
So I want to compare B(i_1,j_1) is equal A(i_1,j_1; i_2,j_1; i_3,j_1;.....; i_100_j_1) in these two matrices, i.e, we need to compare first row, first column of matrix B and all row, first column of matrix A.
If they are equal - 1, if not equal - 0. And they will be new matrix C.
The elements are numbers not strings.
What function can i use in this case if I wanna again compare A and B1 (Like B) is 10x1 matrix too ? Perhaps i will add B2, B3..and so on. plz help me. Thanks! Regards, Kyaw Kyaw
2 Comments
Image Analyst
on 13 Apr 2014
Are they integers or floating point? See the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
pioneer
on 13 Apr 2014
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!