How can I adress merged cells in excel sheet?
33 views (last 30 days)
Show older comments
Denny Milakara
on 2 Oct 2020
Commented: Sergio Silva
on 24 Oct 2022
For example: cells A1:D1 are merged und contain the string 'test'. How can I correctly adress these cells to get the string?
I tried by adressing the first cell of merged cells but read out the first letter only.
0 Comments
Accepted Answer
Kiran Felix Robert
on 8 Oct 2020
Hi Denny,
The following is an example, assuming you have merged cells A1 to D1 you can specify the range as,
M = readcell('Book1.xlsx','Range','A1:D1');
This will readout 4 cells with M(1) containing the required text
Or
M = readcell('Book1.xlsx','Range','A1:A1');
This will readout the merged cells with M containing the required text
Kiran Felix Robert
1 Comment
Sergio Silva
on 24 Oct 2022
What if I'd like to have each merged cell filled with the same content (for example, I want M to be equal to {'text' 'text' 'text' 'text'})?
Thanks!
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!