How to delete the last rows and columns?

3 views (last 30 days)
Omar B.
Omar B. on 21 Feb 2020
Commented: Adam on 21 Feb 2020
How to delete the last three rows and three columns from the following matrix without change N and then multiply the last off diagonal by 6?
then how can we store the new matrix?
M = zeros(N,N);
>> M( 1:1+N:N*N) = a;
>> M(N+1:1+N:N*N) = b;
>> M( 2:1+N:N*N-N) = c
M =
-1 4 0 0 0 0 0 0 0 0
2 -1 4 0 0 0 0 0 0 0
0 2 -1 4 0 0 0 0 0 0
0 0 2 -1 4 0 0 0 0 0
0 0 0 2 -1 4 0 0 0 0
0 0 0 0 2 -1 4 0 0 0
0 0 0 0 0 2 -1 4 0 0
0 0 0 0 0 0 2 -1 4 0
0 0 0 0 0 0 0 2 -1 4
0 0 0 0 0 0 0 0 2 -1

Answers (0)

Categories

Find more on Characters and Strings 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!