Gnovice's suggestion is even simpler than mine.
Up vote 4 down vote favorite share g+ share fb share tw.
I have a m-rows n-columns matrix in matlab, say M. I have a n-element row vector, i.e. An 1-row n-column matrix, say X.
I know X is a row somewhere in M. How can I find the index of M? Matlab link|improve this question asked Jun 2 '11 at 2:51Martin642111 69% accept rate.
EDIT: gnovice's suggestion is even simpler than mine: ~,indx=ismember(X,M,'rows') indx = 3 FIRST SOLUTION: You can easily do it using find and ismember. Here's an example: M=magic(4); %#your matrix M = 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 X=9 7 6 12; %#your row vector find(ismember(M,X),1) ans = 3.
2 You could modify your solution slightly using the 'rows' argument to ISMEMBER to remove the need for FIND: ~,index = ismember(X,M,'rows') – gnovice Jun 2 '11 at 3:19 @gnovice: thanks :) I've edited my solution. – Bring back spy Jun 2 '11 at 3:47.
This is a non-loop version. It is only suitable, if M (your matrix) is not very large, ie. N and m are small.
X is your row: function ind = findRow(M,X) tmp = M - repmat(X,size(M,1),1); ind = find(tmp,1); end If M is too large, it might be faster, to iterate the rows of M and compare every row with your vector. @Edit: renamed variables to match the names used in the question.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.