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

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

 Réponse acceptée

jmxmeag
jmxmeag le 25 Mai 2023

0 votes

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

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!