Filter löschen
Filter löschen

delete a row, or column.

2 Ansichten (letzte 30 Tage)
ck
ck am 5 Jul. 2016
Kommentiert: ck am 5 Jul. 2016
I have a matrix 'b' with 1201 rows and 1 column(1203x1), but the last row is not needed and I want to delete the last row making it (1200x1).
Can I use any function for this?
Thank you

Akzeptierte Antwort

James Tursa
James Tursa am 5 Jul. 2016
Bearbeitet: James Tursa am 5 Jul. 2016
Not sure if you have a 1201x1 or a 1203x1. But to delete the last row:
b(end,:) = [];
To retain the first 1200 rows:
b = b(1:1200,:);
If b is 1201x1 these will give the same result.
Since you have a column vector I really didn't need the : for the columns, but decided to include it since that form will work for a matrix also.
  1 Kommentar
ck
ck am 5 Jul. 2016
Thanks ! it helped!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by