Asked by john borsellino
on 14 May 2013

what function will recombine my dataset when matlab automatically seperates my id column and row headers from the data

*No products are associated with this question.*

Answer by Walter Roberson
on 16 May 2013

Accepted answer

Use the three-output version of xlsread(), and use the third output, "raw". It will reflect what is in the original file.

The first output, the numeric data matrix, will automatically have initial text rows removed (under the assumption that they are column headers) and will also have initial text columns removed. I think it also has trailing rows and columns that are entirely NaN removed. This is because one of the most common operations on an excel file is to work just on the numeric portion, *as a numeric array*. Numeric arrays cannot have strings in them.

The third output, "raw", will be a cell array, not a numeric array. And that *does* mean that if you want to extract the numeric subset of it, you are going to have to convert that subset to a numeric array (cell2mat()) if that is the form you want to operate on.

When you go to write out the data, you will be needing a cell array, if you want to have both numeric values and strings.

Image Analyst
on 16 May 2013

john borsellino
on 16 May 2013

Answer by Image Analyst
on 15 May 2013

Does it look all separated when you open it up in Excel? If so, then you wrote out the workbook using strings in xlswrite() instead of cells. If the string is inside a cell, then the whole string will be in one Excel cell. If you just used xlswrite to write out strings, then it will put each character into its own cell in Excel. So tell me (1) did you write out the workbook with xlswrite(), and if so, (2) do you have one character per Excel cell?

Show 1 older comment

john borsellino
on 15 May 2013

Image Analyst
on 16 May 2013

john borsellino
on 16 May 2013

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 2 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75771#comment_148987

How are you reading the data in? Are your headers text strings? Is your data numeric ? When you say you need to put them back together, then are you wanting to produce a text array or a numeric array?

## john borsellino (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/75771#comment_149154

i can import the data from an excel file or a tab delimited file, matlab seperates the identifier column(made up of characters..ex. 1456710_at) and the row of column headers(made up of characters...ex. mrl control 1) from the data(made up of numbers only)..i get 1 variable, "data" and a 2nd variable "text data" both are different sizes...i have created a new column from the "data" and i want to put the "text data" and the "data" and the new column of data together and export into excel...so "what function will recombine my 'data' and 'text data' variables with my new column...thankyou for your time and input...i think we want to call it a "dataset" in matlab jargon