How can I delete the last row of a table based (if it will have a changing length)?
Code:
clc;
clear all;
close all;
x = 1:10
y =11:20
lastrow = length(x);
t = table(x,y)
t([lastrow,:) = [];
CodePudding user response:
You can use the end
function to access the last row or column.
I think you wanted to create a 10 by 2
table. If you want to do so, you should define x
and y
as a column vector, not a row vector.
clc;
clear all;
close all;
x = (1:10)';
y =(11:20)';
% lastrow = length(x);
t = table(x,y);
t(end,:) = [];
disp(t)