理论
参考官方教程:
https://ww2.mathworks.cn/help/matlab/ref/string.html
方法很多,只讲述我用的方法。假设需要创建 m × n m \times n m×n维字符串矩阵。
- 创建 m × n m \times n m×n维普通矩阵
a=zeros(m,n);
- 利用 String 函数将原矩阵转换为字符串矩阵
a_string=string(a);
- 使用矩阵。
实践
Num=8;
filename=string(zeros(1,Num));
for i=1:Num
filename(i)="DFIG_2011_03_0"+i;
end
输出如下:
T
h
e
e
n
d
.
The \ end.
The end.