xlswrite using for loop to increment cells

4 ビュー (過去 30 日間)
Nicolas Jalbert
Nicolas Jalbert 2017 年 11 月 29 日
回答済み: Arjun Nagendran 2021 年 5 月 24 日
Hi,
I have a result to my program, which is 211 matrices of [366 rows * 3 columns] each.
I am trying to write the 211 matrices side by side into excel, but I do not find a way to increment the field "xlRange" in the xlswrite function, because it only takes character values in between ''.
Is there a way to do it?
Thanks

回答 (1 件)

Arjun Nagendran
Arjun Nagendran 2021 年 5 月 24 日
Probably too late, but here's one way to do this.
Create a mapping function as follows:
cell_mapper = @(x,y) strcat(char(64 + x),num2str(y))
Use the mapper to generate your new cell as follows:
mapper(1, 1) = 'A1';
mapper(3, 1) = 'C1';
For explanation, when the above function is evaluated with x = 1, y = 1, the output is:
strcat(char(64 + 1), num2str(1)) = strcat('A', '1') = 'A1'

カテゴリ

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