Need help making a plot from data in Excel with three columns and 2000 rows, to get two variables on the same axis.

3 次查看(过去 30 天)
I have an excel spreadsheet that I need to plot for a time response question that includes three columns of data and 2000 rows. The 2nd and 3rd column need to be on the same x-axis, and I cannot figure out how to get the spreadsheet referenced into the script as well as I do not know the correct functions. I know the basic functions to get a normal plot, but since there is this much data and 3 variables, I am lost on what goes into the script. I am able to import the data into MATLAB but not the code.

回答(1 个)

dpb
dpb 2022-10-5
Size of data is of no matter to syntax -- if you can plot a vector of 5 elements, you can plot one of thousands...
data=readmatrix(fullfile('YourDataDirectory','YourFile.xlsx')); % read the data as an array
plot(data(:,1),data(:,2:3))
Done except for x/y labels, title, etc., etc., ...

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by