I have 2 columns and 10 rows of numerical data in my excel file. How to import this data in to MATLAB and then plot it?
6 次查看(过去 30 天)
显示 更早的评论
0 2.49939
2.00E-04 -1.28174
4.00E-04 3.05481
6.00E-04 0.790405
8.00E-04 -0.448608
1.00E-03 2.28577
1.20E-03 1.11084
1.40E-03 8.54E-02
1.60E-03 2.30713
1.80E-03 1.77307
2.00E-03 -0.83313
2.20E-03 3.22571
2.40E-03 1.34583
2.60E-03 0.27771
2.80E-03 1.19629
3.00E-03 0.341797
3.20E-03 1.36719
3.40E-03 1.96533
3.60E-03 0.448608
3.80E-03 3.26843
4.00E-03 0.683594
4.20E-03 -1.83716
4.40E-03 4.14429
For example, I have this kind of numerical data with 2 column and 10 rows in my excel file. How to import the Excel file to MATLAB? I need the data to plot the graph.
0 个评论
采纳的回答
Martijn
2011-2-2
编辑:MathWorks Support Team
2018-11-8
Importing data from Excel can be done using the “readtable” function.
For example, to read all data from myfile.xls:
T = readtable('myfile.xls')
Or read only a specific range from a specific sheet using:
T = readtable('myfile.xls', 'Sheet',1, 'Range','A1:B10')
Plot the data from the table using a visualization function. For example, use “scatter”:
X = T.Var1; % First column of data
Y = T.Var2; % Second column of data
scatter(X,Y);
For more information, see:
3 个评论
Image Analyst
2013-11-3
The file is not there. Correct the filename, or else find the file and put it in that folder.
更多回答(4 个)
Davide Ferraro
2011-2-2
编辑:John Kelly
2015-2-26
If you prefer to use an interactive approach you can double click on the Excel file from the Current Folder browser and interactively import the data. As soon as the data is in your workspace you can use PlotTools to quickly create and customize your plot.
The Import Wizard GUI is presented on page:
Chetan Rawal
2015-9-10
There are newer ways to do this using Tables. See this link for all options of using MATLAB with Excel:
0 个评论
woldie kassie
2017-3-28
编辑:woldie kassie
2017-3-28
if the excel data file contains look like this
Day Spinning Weaving Finishing Garment output1
1 3830.6 12577.7 0 3942.7 78766 65868
2 3013.3 11035.3 0 0 78773 65873
3 3655.3 9821 0 3069 78780 65878
4 5936.7 12126 0 3365.3 78786 65883
5 3852.5 14302.3 0 3639 78793 65888
6 5640 14333.8 39343.9 1004.1 788800 65893
7 6386.4 14622.2 44093.96 4108 0 0
8 6990.9 14389.1 44854.1 4493.36 78813 65902
9 6448.3 14087.4 0 3679 78820 65907
10 5428.7 15500 0 8258 78826 65912
11 5463.8 16029.9 61814.64 7309 78833 65916
12 6172.6 16152 48760.44 5354.4 78846 65921
13 6669.4 17066.5 54245.9 4537 0 0
14 6612.6 16067 60566.6 3982 78859 65926
15 7273.3 15764 47332.84 1834 78867 65935
16 5666.5 14364 0 0 78874 65940
17 6427 15603 0 2514 78881 65945
18 6832.5 17314 38463 5561 78888 65950
19 6936.1 17858 40385.5 4090 78895 65955
20 6789.4 17788 30935.37 5748 0 0
21 7077.1 17485 44668.53 4132 78981 65960
22 7318.4 16639 63828.8 4138 78995 65965
23 7302.4 15000 42787.42 0 78921 65974
24 7418.5 17242 48211.74 4663 78927 65978
25 7946.4 16113 56758.1 6430 78935 65982
26 7864.5 14249 24724.14 6983 78940 65988
27 7880.9 16250 29700.24 4800 0 65993
[v,T,vT]=xlsread('Book1.xlsx') ;
cla;
hold on;
title('Decision Boundary at Epoch Number ');
t=v(:,1);is the x-axis
y=v(:,2);
plot(t,y)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!