フィルターのクリア

building a square matrix out of a vector

4 ビュー (過去 30 日間)
Hossein
Hossein 2014 年 3 月 8 日
コメント済み: Hossein 2014 年 3 月 8 日
Hi everyone,
im trying to build a [n X n] matrix from a [1 n*n] vector. can anybody give me a simple code?

採用された回答

Mischa Kim
Mischa Kim 2014 年 3 月 8 日
編集済み: Mischa Kim 2014 年 3 月 8 日
Hossein, use reshape:
A = 1:4*4;
n = sqrt(length(A)); % if A is indeed an n*n vector
B = reshape(A,n,n)
  1 件のコメント
Hossein
Hossein 2014 年 3 月 8 日
tnx

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by