How can I convert a vector to 2D matrix correctly?

9 ビュー (過去 30 日間)
Szabó-Takács Beáta
Szabó-Takács Beáta 2015 年 9 月 29 日
コメント済み: Guillaume 2015 年 9 月 30 日
Dear All,
I have a vector A(33807). I would like to convert it to matrix B(177X191). I tried it with reshape function:
B=reshape(A,[177, 191]);
But I am not sure that it is correct. Could someone recommend me a better way? Thank you for your help in advance!
  3 件のコメント
Szabó-Takács Beáta
Szabó-Takács Beáta 2015 年 9 月 29 日
Dear Guillame, Thank you for your comment. I would like to convert the vector(33807) to matrix based on lambert conformal conic projection.
Guillaume
Guillaume 2015 年 9 月 30 日
That makes absolutely no sense. The lambert conformal conic projection converts latitude and longitude into x and y, not 1D into 2D.

サインインしてコメントする。

回答 (1 件)

Thorsten
Thorsten 2015 年 9 月 29 日
編集済み: Thorsten 2015 年 9 月 29 日
That's correct. Note that reshape works along order of dimensions, so in this case the first 177 values of A would go to the first column of B, the next 177 values to the second column, and so on.
If instead the first 191 values should go to row 1, you have to write
B=reshape(A,[191, 177])';

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by