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 CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by