replaceLine =2; fid = fopen('Downloads\mat.py', 'r+'); X = fread(fid); fclose(fid); for k=1:(replaceLine-1); fgetl(X); end fseek(X, 1, 'bof'); fprintf(X,'%s',mat_file); py_File= sprintf('r%d_r%dr.py',pressure_grad,pressure_max); %filename of py file
path1=['F:\excel\' py_file]; fwrite(path1,X);
I am getting an error in fread function and fgetl function.
Best Answer