如何使xlswrit​e的写入位置变量xl​Range,列号(A​,B,C...)递增​。

已知函数xlswrite(filename,A,sheet,xlRange),
要使xlrange写入位置纵向移动,只要写个从A1到An的循环就可以了。
但是要让xlrange写入位置水平移动,如何写变量让其从A1到???1循环?
要是遇到写入位置需要移动很多位的,使用ASCII转成数字,之后+1,再转成字符的方法就太麻烦了。

 Accepted Answer

jmxmeag
jmxmeag on 25 May 2023
先定义一个全列号变量,然后根据输入n查询第n列的列号就可以了。
col_str = ['A':'Z'];  %假设到Z
n = 6;
xlswrite(filename, A, sheet, ['A1:','col_str(n),'1']);

More Answers (0)

Categories

Find more on 图形对象的标识 in Help Center and File Exchange

Tags

Asked:

on 25 May 2023

Answered:

on 25 May 2023

Community Treasure Hunt

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

Start Hunting!