I want to change the value of a couple of bytes in a large binary file using matlab's fwrite command. What I am trying to do is open the file using fopen(filename,'r+',precision) then read down the file using fread(fid,NUM,'int32') (this all works). Once I get to the file position where I want to write (overwrite) the values of the next bytes, I use the command: fwrite(fid,variable_name,'int32'). Then I close the file:fclose(fid).
OK, so then I go back and re-read the file and these bytes haven't changed!
So is this not possible? Or is 'r+' the wrong thing to use?
Thanks.