Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Data from excel sheet

Status
Not open for further replies.

ysg519

Mechanical
Sep 1, 2007
17
0
0
US
I have a .xls sheet which consists of strings and numerics. I want to load it into a matrix in order to do further calculations etc. The xlsread function in matlab works only if the strings are placed in the header. In my case however it does not work since the strings are placed in several columns. Please help.

Thanks

 
Replies continue below

Recommended for you

clear as mud. show example/demo of your sheet or better description of what is in the numeric and text arrays from xlsread. Sometimes you can format an extra sheet in the workbook which is actually characters (text) but looks like numbers. Then all characters will be in one text array. Just convert to nums.
 
[num,txt,A]=xlsread('c:\temp\book1.xls');
A:),size(num,2)+1:end)=[]; % You have some extra crap in there. Delete it.

A{2,2} % Use curly braces for addressing cell contents
A{end,end} % make sure we got it.

isnumeric(A{1,1}) % checks before dealing with contents
ischar(A{4,2})
 
Status
Not open for further replies.
Back
Top