MATLAB Answers

0

Reset the order of table columns

Asked by Zeynab Mousavikhamene on 15 Nov 2019 at 17:20
Latest activity Edited by Zeynab Mousavikhamene on 15 Nov 2019 at 18:49
Is it possible to change the order of columns in matlab table? Lets assume 5th column is parameter A. Can I bring it to the first column?

  0 Comments

Sign in to comment.

Tags

2 Answers

the cyclist 님의 답변 15 Nov 2019 17:31

% Make the table
x = rand(2,1);
y = rand(2,1);
tbl = table(x,y)
% Rearrange the column order
tbl = tbl(:,[2 1]);

  0 Comments

Sign in to comment.


Steven Lord 님의 답변 15 Nov 2019 18:20

If you're using release R2018a or later you could use the movevars function.

  0 Comments

Sign in to comment.