How can I add three columns and three rows to a defined matrix?

4 views (last 30 days)
I have a matrix 590x590 and I have to add three intermediate colomuns and three intermediate rows between the first and the second column/row of the original matrix and then other three rows and columns between the third and the fourth and so on. In other words I have to obtain a new matrix whose size is 1770x1770. How can I do it?
  2 Comments
Torsten
Torsten on 21 Jan 2022
Edited: Torsten on 21 Jan 2022
And the lengths of the inserted rows/columns change from time to time to keep the complete matrix square ?
E.g. the rows/columns that you add in the second step between the third and the fourth row/column of the original matrix (or between the third and the fourth row/column of the matrix you obtained from the first step ?) should already have length 593.
Maybe you should give a small example for clarification.
federica incatasciato
federica incatasciato on 21 Jan 2022
No. They should have the same length. What I mean is:
column 1 x x x column 2 x x x column 3 ...
row1
s
s
s
row2
s
s
s
row3
...
Where x are the added columns and s are the added rows

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 21 Jan 2022
Try
newMatrix = imresize(oldMatrix, [1770, 1770]);

Categories

Find more on Creating and Concatenating Matrices 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!