Calculate table column with a loop
Mostrar comentarios más antiguos
Hi Matlabfriends,
I have a large table with data (120 column and 200 rows). I have to subtract column 2 (all rows) from column 1 (all rows),
column 3 (all rows) from column 2 (all rows), and so on, until column 120 (all rows). Can I solve this with a loop, how?
Thanks!
Here is my try (note: I'm an absolutley beginner):
for i=1:120
variable1(i,1:120)=table(i,1:2:119) - table(i,2:2:120);
end
Respuesta aceptada
Más respuestas (1)
Takumi
el 6 de Nov. de 2019
table = rand(200,120); %sample data
[row,col] = size(table);
for i = 1:col-1
variable1(:,i) = table(:,i+1) - table(:,i);
end
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!