No BSD License  

Highlights from
Spreadsheet2Structure

4.0

4.0 | 1 rating Rate this file 1 Download (last 30 days) File Size: 1.95 KB File ID: #8127
image thumbnail

Spreadsheet2Structure

by Michael Robbins

 

27 Jul 2005 (Updated 27 Jul 2005)

Reads in a spreadsheet and converts it into a structure whos field names are taken from the column h

| Watch this File

File Information
Description

SPREADSHEET2STRUCTURE Reads in a spreadsheet and converts it into a structure whos field names are taken from the column headers in the spreadsheet.
 
  USAGE:
  1. Read in the file with XLSREAD
  2. Pass the text component to
     SPREADSHEET2STRUCTURE along
     with the first column header
  3. SPREADSHEET2STRUCTURE will
     return the strucuture, the row
     number of the header strings
     and the header strings
 
  EXAMPLE
 
  [num,TXT,raw]=xlsread(yourfile);
  [IV,HeaderRow,Headers] = ...
     Spreadsheet2structure(TXT,'customer')
 
  Will take an excel file that looks
  like this:
 
        A B C D
    +--------------------------------
  1 |
  2 | customer amount price
  3 | Smith 10 100
  4 | Jones 4 9.2
 
  It will skip column A and rows 1 and 2,
  because 'customer' doesn't appear until
  cell B2, and returns:
 
  IV.customer = {'Smith','Jones'};
  IV.amount = {'10','4'}
  IV.price = {'100','9.2'}
  HeaderRow = 2
  Headers = {'customer','amount','price'}
 
  It's not fancy, but it works

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
27 Sep 2007 Jeff Evans

Just what i was looking for. I modified the file a little so xlsread is called within it, rather than needing to be called sepearately. So now the only inputs it needs are ULHeaderValue and filename. I also added a clear statement to get rid of the raw, num, and TXT variables created during the load.

thanks for this useful tool!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
path Michael Robbins 22 Oct 2008 07:54:21
directories Michael Robbins 22 Oct 2008 07:54:21
files Michael Robbins 22 Oct 2008 07:54:21
spreadsheet Michael Robbins 22 Oct 2008 07:54:21
xl Michael Robbins 22 Oct 2008 07:54:21
excel Michael Robbins 22 Oct 2008 07:54:21
microsoft Michael Robbins 22 Oct 2008 07:54:21
ms Michael Robbins 22 Oct 2008 07:54:21
xlread Michael Robbins 22 Oct 2008 07:54:21
xlsread Michael Robbins 22 Oct 2008 07:54:21
excelread Michael Robbins 22 Oct 2008 07:54:21

Contact us at files@mathworks.com