How do i replace numbers from one matrix with numbers of another matrix?

1 view (last 30 days)
A = [1:1:5; 5:1:9; 9:1:13; 13:1:17; 17:1:21; 21:1:25;] B = [5:6:35; 27:-3:12; 55:5:80] I need to replace the numbers in the last 4 columns of the 1st and 4th rows of A with the last 4 columns of the 1st and 3rd rows of B.

Accepted Answer

Star Strider
Star Strider on 3 Feb 2015
This works:
A([1 4], 2:5) = B([1 3], 3:6);
It could be made more general if necessary. This is specific because it is what you asked for.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!