フィルターのクリア

assigning array to another

43 ビュー (過去 30 日間)
Hello Matlab
Hello Matlab 2015 年 4 月 3 日
コメント済み: Hello Matlab 2015 年 4 月 3 日
I'm struggling with the rows index of the matrix.
First I have Matrix A which is 1125 X 30 dimensions. I want to initialize Matrix B as 10 X 30, first as zeros and then matrix B takes the first ninth rows of matrix A, and keep its last rows as zeros. How can I do that?
  6 件のコメント
James Tursa
James Tursa 2015 年 4 月 3 日
Where in B do you want these values of A to be assigned?
Hello Matlab
Hello Matlab 2015 年 4 月 3 日
編集済み: Hello Matlab 2015 年 4 月 3 日
The 1st through the 9th rows also

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

採用された回答

James Tursa
James Tursa 2015 年 4 月 3 日
編集済み: James Tursa 2015 年 4 月 3 日
Is this what you want?
B = zeros(10,30); % initialize Matrix B as 10 X 30, first as zeros
B(1:9,:) = A(1:9,:); % B takes the first ninth rows of matrix A
  1 件のコメント
Hello Matlab
Hello Matlab 2015 年 4 月 3 日
Thanks so much. Now I get it, I was assigning only the rows, and forgot to put for columns (:).

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by