Limiting vectors to a certain number of rows

조회 수: 5 (최근 30일)
Giovanni
Giovanni 2013년 12월 12일
댓글: Vaclav Rimal 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 of this matrixes to say 4 for each one?

답변 (1개)

Vaclav Rimal
Vaclav Rimal 2013년 12월 12일
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
Giovanni
Giovanni 2013년 12월 12일
thanks for your help but i already hae a function. This function say produces 5 matrixes of 3 columns but different number of rows. How do i limit the number of rows of all the matrixes to the min number of rows
Vaclav Rimal
Vaclav Rimal 2013년 12월 12일
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?

댓글을 달려면 로그인하십시오.

카테고리

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