Turning a column vector into a rectangular matrix

3 ビュー (過去 30 日間)
Matt Karlson
Matt Karlson 2015 年 11 月 24 日
コメント済み: Matt Karlson 2015 年 11 月 24 日
I have a column vector of data and would like to break it up into a rectangular matrix. However, I would need to add NaN elements in order to make it rectangular; I have multiples pages of the column, how can I do this?

採用された回答

John D'Errico
John D'Errico 2015 年 11 月 24 日
編集済み: John D'Errico 2015 年 11 月 24 日
I wrote a wreshape tool some years ago. It pads as necessary, and allows you to specify the pad element. Not sure if I posted it on the file exchange, and I'm feeling too lazy to post it now. So I'll just attach it.
A = wreshape(1:5,[2 4],'pad',NaN)
A =
1 3 5 NaN
2 4 NaN NaN
  1 件のコメント
Matt Karlson
Matt Karlson 2015 年 11 月 24 日
Awesome thanks.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by