How to plot the same variable from multiple excel files?

I have 3 different .cvs files with the same variables.
I would like to compare the data sets against eachother by plotting them.
A. How do I import them so that I can distinguish from data set 1 and 2 for Plotting.
B. The variables x in the plot will be time based. How can I edit the way it plots or the data so that the time can be same. Do I need to create a new variable like 1-100 for x axis?

回答(1 个)

A. If you don't have to actually calculate across the various datasets, just process them sequentially -- a loop counter could be all needed to keep them straight.
B. If do need to use together, making each 2D file content a plane in a 3D array often works well; another solution is to use cell array to hold each set.
C. If you don't have specific actual time data, then yes, you should probably create an x vector that represents the time; if the numbers of elements are not the same in each file, then B. above doesn't work as well but you can interpolate to a fixed time base if that's the desire (see interp1)
D. There's the timeseries object/data type you might want to investigate.

产品

版本

R2018a

标签

提问:

2018-11-13

回答:

dpb
2018-11-13

Community Treasure Hunt

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

Start Hunting!

Translated by