Thread Subject: putting together "cell" and "double"

Subject: putting together "cell" and "double"

From: Anna Chen

Date: 1 Aug, 2008 18:13:03

Message: 1 of 4

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?

thanks!

Subject: putting together

From: Scott Burnside

Date: 1 Aug, 2008 19:09:02

Message: 2 of 4

"Anna Chen" <icedredtea@yahoo.com> wrote in message
<g6vjne$68m$1@fred.mathworks.com>...
> 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?
>
> thanks!

Anna,

Does your data look like this?:

Symbol, Exchange, Date, Time, Bid
CMGI, ARCA, 20040901, 9:31:33, 1.99
GE, ISLAND, 20040901, 9:31:34, 34.63
QQQQ, AUTO, 20040901, 9:31:35, 35.13

That is, do you have a delimited headerline? Is the data a
mix of numeric and text columns?

If so, you can take a look at autodataread.m in the File
Exchange.

Scott

Subject: putting together "cell" and "double"

From: Peter Perkins

Date: 1 Aug, 2008 19:16:41

Message: 3 of 4

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

Subject: putting together "cell" and "double"

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 1 Aug, 2008 19:17:39

Message: 4 of 4

In article <g6vjne$68m$1@fred.mathworks.com>,
Anna Chen <icedredtea@yahoo.com> wrote:

>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

Is that for display purposes only (that is, you are expecting to
get a character output that happens to have that format), or are
you hoping to somehow get a single matrix that contains the strings
as column headers but also has pure numeric values for the columns?
It isn't too bad to do for display purposes, but in Matlab
numeric matrices cannot have character headers.

--
  "I will not approve any plan which is based on the old principle
  of build now and repair later." -- Walter Hickle

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com