How to properly import data from excel documents and graph them?

4 次查看(过去 30 天)
I have about 27 of these types of excel files from a wind tunnel experiment i need to put in my code. The one circled in red will be one variable and the ones circled in blue will be another. Every time i try to import the information into matlab i get this error.
how do i fix it; also how would you say graph a graph with x as the x-axis and three of the Cp0_...(30,90,40 f/s) values as different lines in the y-axis.
  4 个评论
me
me 2015-9-16
编辑:me 2015-9-16
I converted the files and they are opening up now. Thank you.
But about my second question how wold I graph three or more of the files(the green part in each file) onto one figure. with x axis being the function named x.
dpb
dpb 2015-9-16
Read the first file and plot it. After done, execute
hold on
to retain the axes rather than overplot.
Then iterate over the remaining files ( dir is very useful here). Just keep plotting and voila! you're done when the loop ends.
Or, alternatively, since there's not much data in terms of size, read all the files in a loop storing the additional values as additional columns in a data array then plot all at the end. Only deal here is that if there aren't the same number of observations in each data set but that adds only a little extra complexity to the details.

请先登录,再进行评论。

回答(1 个)

Kirby Fears
Kirby Fears 2015-9-16
编辑:Kirby Fears 2015-9-16
To summarize all the comments, xlsread won't work on a file improperly saved in xls format, so you have to re-save them properly (which you did already, great).
Once you've read the files you want and identified the numerical vector's you're trying to plot, you can simply plot them all at once using this syntax:
plot(X1,Y1,LineSpec,...,Xn,Yn,Linespec);
X is the vector of x-axis values and Y is the vector of values you circled in the picture. You don't need to specify LineSpec if you don't want to.
As dpb pointed out, you could just plot one pair at a time like this:
plot(X1,Y1,LineSpec);
hold on;
plot(X2,Y2,LineSpec):
etc...

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by