Deleting a row or column of a matrix

3 ビュー (過去 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);
  1 件のコメント
Fangjun Jiang
Fangjun Jiang 2011 年 8 月 9 日
My condolences... :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by