MATLAB: Delete a row, or column. matrix rows deletion I have a matrix 'b' with 1201 rows and 1 column(1203×1), but the last row is not needed and I want to delete the last row making it (1200×1). Can I use any function for this? Thank you Best Answer 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. Related SolutionsMATLAB: How to delete specific rows in a matrix NewMatrix = YourMatrix(YourMatrix(:,1)~=0, :); MATLAB: Calculation within a matrix AA - if A is your matrix, then the calculation that you wish to perform could be written as B = (A(:,7) - A(:,1))./A(:,3);Then just append B as your 8th column of A as A = [A B];Try the above and see what happens! Related QuestionImage zero Padding row, columnDeleting rows and columns of a matrixHow to change an entire column.Repeat last row at the end of matrixSubplot titles on each column.
Best Answer