フィルターのクリア

Limiting vectors to a certain number of rows

1 回表示 (過去 30 日間)
Giovanni
Giovanni 2013 年 12 月 12 日
コメント済み: Walter Roberson 2013 年 12 月 12 日
Hi, i have created a function that creates n lots of a matrix of 3 columns but different number of rows. How do i limit the number of rows so that each of this matrixes has say 4 rows?

回答 (1 件)

Wayne King
Wayne King 2013 年 12 月 12 日
It depends which 4 rows you want to choose out of each of the matrices. Do you always want the first 4 rows?
If so, then in your code after you create the matrix, remove the trailing rows.
X = randn(10,10);
X(5:end,:) = [];
  2 件のコメント
Giovanni
Giovanni 2013 年 12 月 12 日
thanks man yeah i want the first 4 rows of each, what does the randn(10,10) command do?
Walter Roberson
Walter Roberson 2013 年 12 月 12 日
randn(10,10) creates some random sample data to illustrate the solution.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by