MATLAB Answers


Issue with xlsread and merged cells

Asked by Matthew
on 29 Apr 2013


Im trying to import data from an excel file using xlsread. Im currently having an issue when trying to import the "comments" line from the excel file which is in fact 35 cells merged into one in excel.

When trying to import this cell it imports the 35 base cells on the single merged cell, causing me issues as there is multiple comments.

Here is the code below:

[num,str]= xlsread(Bag_Report,2,'B20');
remarks = strcat(rem1,rem2,rem3,rem4,rem5,rem6)

Which imports:

rem2 =

Columns 1 through 15
    ''    ''    ''    ''    ''    ''    ''    ''    ''    ''    ''    ''    ''    ''    ''

Any help would be appreciated!

  1 Comment

I cannot reproduce (/understand) your problem on R2012a,64bit,Windows7 with Excel installed. However, doc says

    When the specified range overlaps merged cells:
    On Windows systems with Excel, xlsread expands the range to include 
    all merged cells.
    On systems without Excel for Windows, xlsread returns data for the
    specified range only, with empty or NaN values for merged cells


No products are associated with this question.

0 Answers

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!