I am working with Matlab R2016a, and I get error for the follwing code which is form mathworks's website.
The thing is whenever I use fprintf, I get the same error.
Thanks a lot for the help.
x = 0:.1:1; A = [x; exp(x)]; fileID = fopen('exp.txt','w'); fprintf(fileID,'%6s %12s\n','x','exp(x)'); fprintf(fileID,'%6.2f %12.8f\n',A); fclose(fileID);
Error:
Error using fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in Untitled (line 5)
fprintf(fileID,'%6s %12s\n','x','exp(x)');
Best Answer