Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Delete and insert row in different matrix
Replies: 5   Last Post: Aug 20, 2013 11:38 PM

 Messages: [ Previous | Next ]
 Alan Posts: 48 Registered: 7/30/13
Re: Delete and insert row in different matrix
Posted: Aug 20, 2013 2:51 PM

"John Dickson" wrote in message <kv0cn9\$lpq\$1@newscl01ah.mathworks.com>...
>
> A is 50*85 matrix and B is 30*85 matrix. All I need is to delete ith row in matrix A and insert it at the end of B matrix. New matrix will be A =49*85 and B= 31*85.
> A and B are two different data sets which doesn't depend on anything. I select the row'i'
> using a third matrix which is 30*50. If row i in the third matrix is the max of the minimums ([maxValue, rowIdx] = max(C(1,end),[],1)) then I remove ith row from A and insert it into B. I use the rowIDx to determine the ith row (row that has maxi of the minimum) which will help me to remove from A using A(rowIdx,:)=[]
> I hope this information will help to solve my issue.
>
> Thanks

I think this will do what you need.

b(end+1,:) = a(i,:); %Copy row to bottom of B
a(i,:) = []; %Delete row from A

Date Subject Author
8/20/13 John Dickson
8/20/13 Alan
8/20/13 John Dickson
8/20/13 Alan
8/20/13 Nasser Abbasi
8/20/13 John Dickson