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!