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

2 次查看(过去 30 天)
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 个评论
Torsten
Torsten 2022-1-21
编辑:Torsten 2022-1-21
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
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

请先登录,再进行评论。

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by