필터 지우기
필터 지우기

Deleting a row or column of a matrix

조회 수: 1 (최근 30일)
Zach
Zach 2011년 8월 9일
I have a Matrix but I only need the first 20 columns of the matrix. I was wondering if there was a way to delete the rest of the matrix instead of having to create a new matrix all together. If it's not possible is there a better way of doing this compare to
for j=1:20
for k=1:20
u(j,k)=y(j,k)
end
end
Thanks in advance!

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 8월 9일
Or y(21:end,21:end)=[]
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2011년 8월 9일
Glass half empty; but you win!

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 8월 9일
u = y(1:20,1:20);

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by