Renaming columns within the variable editior screen

So I took 4 files of data all with 136 columns of data and combined them into one file. Now they are all in one giant workspace. I would like to create a new variable from each column so I can make plots, etc. How do I go about doing this without manually clicking and creating a new variable from each file? Typically I would just import the excel data and create variable vectors from each column but since I combined files this was not an option.

回答(1 个)

So you want to create either 136 or 4*136 = 544 individual variables (depending on whether you "combined" them vertically or horizontally)? That's going to clutter your workspace quite a bit. Instead, just use indexing into your combined array or store your data in a table array.
M = magic(5)
plot(M(:, 4))
title('Fourth column of magic')
T = array2table(M)
figure
plot(T.M2)
title('Second column of magic')
figure
plot(T{:, 1})
title('First column of magic')

类别

在 帮助中心 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息

产品

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by