Code covered by the BSD License  

Highlights from
plotting a .xls spreadsheet

Be the first to rate this file! 13 Downloads (last 30 days) File Size: 2.83 KB File ID: #34942

plotting a .xls spreadsheet

by Stephan Koehler

 

06 Feb 2012 (Updated 07 Feb 2012)

Convenience function for plotting spreadsheets specifying several variables and also conditions

| Watch this File

File Information
Description

General-purpose script for plotting spreadsheets. You can plot multiple variables, select the plotting range and also the plotting conditions:

 xlsplot( [xls file], [x variable], [y1 variable], [y2 variable], ....,
 [condition 1], [condition 2], ..., options )
 if the first ROW of the spreadsheet has a header line then variables are specified
 by just partial unambiguous header titles, e.g. 'x column' or 'x col'
 if the spreadsheet has no header titles, then use standard EXCEL headers,
 such as 'A', 'B', ..., 'AA', 'AB', ...
 to specify a variable in an expression use double quotes in the argument string,
 i.e. '"x col"+"y col"' or 'hypot( "x col" + "y col" )'
 to restrict the plotted dataset you can use logical commands, i.e.
 '"x col">0'
 you can also search for text strings within rows, i.e. 'good' or 'selec'
 you can also specify which rows you want to plot using the syntax 'ROW
 [r1, r2, r3...]'
 
 to test this out, download the example XLS file called 'test.xls' and try
 these commands
 
 to turn off notifications about your plot, set options = 'QUIET'
 to plot data where the x-values are sorted in ascending order, set options
 = 'SORT'
 
 [{plot handle}, {x variable}, {y1 variable}, {y2 variable}...] = xlsplot(...
 returns the plot handle, and the data vectors used in the plot
 *************************************************************
 save this as spreadshet test.xls to run the following examples
 a1 b c comment
 1 1 1 good
 3 9 9 bad
 4 12.66666667 16 good
 5 16.66666667 25 good
 6 20.66666667 36 good
 2 4 4 good
 
  clf; xlsplot( 'test.xls', 'a1', '"b".^2', 'good' )
  clf; xlsplot( 'test.xls', 'a1', '"b".^2', 'SORT' )
  clf; xlsplot( 'test.xls', 'a1', '"b".^2', 'ROW [4:10]' )
  clf; xlsplot( 'test.xls', 'a1', '"b".^2', '"a">3' )
  clf; xlsplot( 'test.xls', 'a1', '"b".^2', '"a">3', 'QUIET' )
  clf; set( xlsplot( 'test.xls', 'a1', '"b".^2', 'good' ), 'marker', 'o', 'color', 'r' )

Required Products MATLAB
MATLAB release MATLAB 6.5.1 (R13SP1)
Other requirements I developed this using mac OSX, but should work fine on other platforms. The problem may be how xlsread works across platforms.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
06 Feb 2012

Fixed a bug relating to xlsread.

07 Feb 2012

fixed minor bugs, and added SORT option

Tag Activity for this File
Tag Applied By Date/Time
data import Stephan Koehler 06 Feb 2012 12:40:22
plot Stephan Koehler 06 Feb 2012 12:40:22
xlsread Stephan Koehler 06 Feb 2012 12:40:22

Contact us at files@mathworks.com