Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Write an array of data to multiple text file but it shows error
조회 수: 1 (최근 30일)
이전 댓글 표시
x =rand(10,1);
for i=1:10
A = x*i;
textFilename = ['akg_' num2str(i) '.txt'];
fid=fopen(textFilename,'w');
fprintf(fid,'%f\n',A(i));
fclose(fid);
end
I get the error
Error using fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.
error in xyz (line 6)
fprintf(fid,'%f\n',A(i));
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170179/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170180/image.jpeg)
댓글 수: 4
per isakson
2018년 2월 10일
I guess you don't have write permission in the current directory
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/187763/image.png)
Write to a different directory
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!