How to fopen in this case?
1 次查看(过去 30 天)
显示 更早的评论
Hi Everybody
Case1
fid = fopen('TTL_1.txt', 'w');
fprintf(fid3,'%s \n','ABCD;');
fclose(fid3);
Case2
file_name='TTL_1';
fid = fopen('file_name.txt', 'w');
fprintf(fid3,'%s \n','ABCD;');
fclose(fid3);
Case1 is OK!
However, Case 2 does not create a file.
How to fopen in this case?
Thanks!
0 个评论
采纳的回答
the cyclist
2023-2-21
You need to concatenate two character arrays, one of which you defined ahead ...
file_name='TTL_1';
fid = fopen([file_name,'.txt'], 'w');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!