MATLAB Answers

Reset the order of table columns

6 views (last 30 days)
Zeynab Mousavikhamene
Zeynab Mousavikhamene on 15 Nov 2019
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.

Answers (2)

the cyclist
the cyclist on 15 Nov 2019
% 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
Steven Lord on 15 Nov 2019
If you're using release R2018a or later you could use the movevars function.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags


Translated by