Engineering Fundamentals: An Introduction to Engineering, 4th ed.c

(Steven Felgate) #1

15.4 Importing Excel and Other Data Files into MATLAB 487


■Figure 15.21 Plot of density of air for Example 14.6 (Revisited).


15.4 Importing Excel and Other Data Files into MATLAB


At times, it might be convenient to import data files that were generated by other programs, such
as Excel, into MATLAB for additional analysis. To demonstrate how we go about importing a data
file into MATLAB, consider the Excel file shown in Figure 15.22. The Excel file was
created for Example 15.4 with two columns: thexvalues and the corresponding volume. To
import this file into MATLAB, from the Menu bar, we selectFile, thenImport Data... , then
go to the appropriate directory, and open the file we want. The Import Wizard window,
as shown in Figure 15.23, will appear next, and the Wizard will import the data and will save
them asxandvolumevariables.
Now let’s say that we want to plot the volume as a function ofx. We then simply type
the MATLAB commands that are shown in Figure 15.24. The resulting plot is shown in
Figure 15.25 on page 489.

Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).

圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀

Free download pdf