xlswrite using for loop to increment cells
4 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Arjun Nagendran
on 24 May 2021
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'
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!