How To Plot Graph In Matlab Using Excel Data
Download Article
Download Article
Whether you lot are an experienced MATLAB user or a novice, you may not exist fully aware of MATLAB's graphing abilities. MATLAB allows you to easily customize, label, and analyze graphs, giving yous more freedom than the traditional Excel graph. In gild to apply MATLAB's graphing abilities to the fullest, though, you must beginning empathize the process for importing information. This pedagogy ready will teach you how to import and graph excel data in MATLAB.
-
1
Open a fresh MATLAB Screen. To make the process of importing and graphing data easier, clear whatever text in the command window with the control clc.
-
2
Open up your desired Excel file. Exist sure to tape the name of the Excel file for later use.
Advertisement
-
iii
Save the Excel file into your MATLAB folder. The pathway for the folder typically is: C:\Users\[your account proper noun]\Documents\MATLAB. Be sure you salvage the file as an Excel Workbook in club to have the proper file format for the import. Once this step is complete, you lot should meet your Excel file in the current binder section in MATLAB.
-
4
Locate the columns that will be exported. Identify the range of each column to be exported. The range of the column is the first cell in a column to the last jail cell in a cavalcade. The proper format for this range is the beginning cell followed by a colon followed by the terminal cell (I.e. "B1:B30")
-
5
Import the information columns to MATLAB. Enter the command var = xlsread('filename', 'xlrange'); into the command window for each cavalcade you want to import. In this control:
- Var is a variable name of your choice (Example: "10" or "y")
- Filename is the name of your excel spreadsheet
- Xlrange is the range of the desired column in the grade "X--:X--",with X being the letter of the column followed by the cell number.
Advertizement
-
one
Modify the line color. Enter the control set(p,'color','[Desired Colour]'); into the command window to modify all the graphed lines to the same color. In this control, p is a reference to the variable you lot prepare your plot equal to in step vi. If yous wish to change the color of merely i line enter set(p(10),'color','[Desired Color]'); into the command line. The 10 in p(ten) is the number that corresponds to the society that the lines are plotted in (Instance: y1 = p(ane), y2 = p(2)).
-
ii
Change the line style. Enter the command set(p,'LineStyle','style'); into the control window to modify all of the graphed lines to the same mode. If you lot wish to change the way of one line just, enter the control set(p(x),'LineStyle','style'); into the command line. In this command, the x in p(x) corresponds to the number in which the lines were graphed (Instance: y1 = p(1), y2 = p(ii)). Common line styles include:
- dashed lines= '--'
- dotted lines = ':'
- solid line = '-'
- dash-dot line = '-.'
-
3
Label your axis. To label the x-axis, enter the command xlabel('text') in the control window. To characterization the y-centrality, enter the command ylabel('text') in the command window.
-
iv
Add a championship to your graph. Enter the command title('text') in the command window. The championship will display at the top of your graph.
-
5
Add together text within the graph. If you wish to enter text near your graphed lines, enter the command gtext('text'). One time you enter the command, a cursor will appear on the graph allowing you to click the area you wish to apply the label. The characterization can be put anywhere in the graph infinite.
-
6
Add filigree lines to the graph. If you wish to put grid lines in your plot for easier reading, enter the command filigree into the command window. Entering the command again volition remove the grid lines.
-
7
Relieve your graph. Click file on upper right mitt side of the MATLAB graph screen followed by save every bit in the bill of fare. Save the graph to the desired location.
Advertisement
Enquire a Question
200 characters left
Include your email address to get a bulletin when this question is answered.
Submit
Advertisement
Thanks for submitting a tip for review!
About This Article
Thanks to all authors for creating a page that has been read 54,440 times.
Is this article upwardly to date?
How To Plot Graph In Matlab Using Excel Data,
Source: https://www.wikihow.com/Import,-Graph,-and-Label-Excel-Data-in-MATLAB
Posted by: morrishisems.blogspot.com
0 Response to "How To Plot Graph In Matlab Using Excel Data"
Post a Comment