Limiting vectors to a certain number of rows

3 vues (au cours des 30 derniers jours)
Giovanni
Giovanni le 12 Déc 2013
Commenté : Walter Roberson le 12 Déc 2013
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?

Réponses (1)

Wayne King
Wayne King le 12 Déc 2013
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 commentaires
Giovanni
Giovanni le 12 Déc 2013
thanks man yeah i want the first 4 rows of each, what does the randn(10,10) command do?
Walter Roberson
Walter Roberson le 12 Déc 2013
randn(10,10) creates some random sample data to illustrate the solution.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by