Hey guys, so basically I'm trying to use the 'find' function in matlab to search a range of rows and a particular column in an array for the indices of elements that have a value of 7. So basically what I did was:
X=zeros(4,5);X(1:3,4)=7;[A,B] = find( X( 1:3,4) == 7 );
What the code is meant to do is search rows 1:3 of column 4 for elements with a value of seven and save the indices of these elements to A(i.e. rows) and B(i.e. columns). A works out fine as I get the values 1,2,3 stored in A but the values gotten in B are 1,1,1. Any idea of what I may be doing wrong please? I know I could achieve this using a for loop but I do not want to as this made my code really slow. Thanks
Best Answer