Path: news.mathworks.com!not-for-mail
From: Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: putting together "cell" and "double"
Date: Fri, 01 Aug 2008 15:16:41 -0400
Organization: The MathWorks, Inc.
Lines: 32
Message-ID: <48936119.4050508@mathworks.com>
References: <g6vjne$68m$1@fred.mathworks.com>
NNTP-Posting-Host: perkinsp.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1217618201 1450 172.31.57.88 (1 Aug 2008 19:16:41 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 1 Aug 2008 19:16:41 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
In-Reply-To: <g6vjne$68m$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:483188



Anna Chen wrote:
> hello,
> i have a file that contains a data table, with data and the 
> header names.  when i use xlsread, the data part gets put 
> as "double," but the header names all get put into "cell" 
> format, and i can't figure out how to splice the two 
> together.  can anyone help?
> 
> i guess basically, if i have something like "dwe ewrwe ere" 
> that is in cell format, and i want to put it over " 1 3 4" 
> which are numbers to get
> 
> dwe ewrwe ere
> 1    3     4
> 
> how would i do that?  

Anna, if you have access to the Statistics Toolbox, the dataset array may be what you are looking for:

>> dwe = 1; ewrwe = 3; ere = 4;
>> ds = dataset(dwe,ewrwe,ere)
ds = 
    dwe    ewrwe    ere
    1      3        4  

and it is possible to read data in the format you describe directly from an Excel file, along with the column names, into a dataset array.  It is really intended more for putting data of different types together into a single array, and is probably overkill for scalar values like that, but you may find it helpful.  An alternative for your specific example might be 

>> struct('dwe',1,'ewrwe',3,'ere',4)
ans = 
      dwe: 1
    ewrwe: 3
      ere: 4