converting a 35x28 matrix into 35x35 matrix

1 回表示 (過去 30 日間)
SUDIPTA GHOSH
SUDIPTA GHOSH 2014 年 4 月 9 日
編集済み: Phillip 2014 年 4 月 9 日
I have one set of data with 1x1.25 degrees resolution and another set with 1x1 degree resolution. On extracting data over India the first set of data is giving a 35x28 matrix while the second set is giving 35x35 matrix. Now to catenate the two data along 3rd dimension the matrix size needs to be same. How can I change the 35x28 matrix into 35x35 matrix?

回答 (2 件)

Phillip
Phillip 2014 年 4 月 9 日
編集済み: Phillip 2014 年 4 月 9 日
Hi,
You can pad your first set of data as follows:
data1Mod = [data1 zeros(35,7)];
This will give a 35x35 matrix which you can then concatenate. This assumes you don't mind padding with zeros. You can obviously pad with anything else.
- Edited -
I should have added that you need to be more clear on how you want to handle the "missing" data. I have just shown how to pad it. You might want to extrapolate, copy etc. Phil

Walter Roberson
Walter Roberson 2014 年 4 月 9 日
You should probably be using interp2() or imresize() to extrapolate one of the two data sets to be the same size as the other; then you can concatenate them along the third dimension.

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by