How can I adress merged cells in excel sheet?

29 ビュー (過去 30 日間)
Denny Milakara
Denny Milakara 2020 年 10 月 2 日
コメント済み: Sergio Silva 2022 年 10 月 24 日
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.

採用された回答

Kiran Felix Robert
Kiran Felix Robert 2020 年 10 月 8 日
Hi Denny,
You can use the readcell function to readout the cell.
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 件のコメント
Sergio Silva
Sergio Silva 2022 年 10 月 24 日
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!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by