I opened a File in Matlab using the a+ permission to read and write, and append data to end of file. I am able to write and append data to the file properly, but I am not able to read.
Though the file permission definition says reading and writing, I am not able to read. Can you please help me here? Anybody encountered this problem?
fid = fopen('E:\code folder\Translation values.txt','a+')
[Array] = fscanf(fid,'%f %f')
The array returned is empty. same is the problem with textscan as well. The Cell array is empty. But when I change the permission to r+, it works fine. Please help me.
The flag
a+stands for “append and read”, thus, the file position indicator pointer probably points to the end of the file. If so, you might need to callfseekorfrewindbefore reading.