Limiting vectors to a certain number of rows

1 visualizzazione (ultimi 30 giorni)
Giovanni
Giovanni il 12 Dic 2013
Commentato: Vaclav Rimal il 12 Dic 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 of this matrixes to say 4 for each one?

Risposte (1)

Vaclav Rimal
Vaclav Rimal il 12 Dic 2013
I don't understand exactly what you are asking, bur suppose you have a matrix A and want to perform a function func on it.
maxrows=4;
if size(A,2)>maxrows
A=A(1:maxrows,:);
end
B = func(A);
  2 Commenti
Vaclav Rimal
Vaclav Rimal il 12 Dic 2013
Hm, I still don't understand what exactly you want to do. Do you want to make all the matrices have at least a given number of rows? Or at least the number of rows what the smallest matrix has? Or do you want to exclude smaller matrices from your procedure?

Accedi per commentare.

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by