here is the bit of code i'm using:
x = dicomread('Test_Image');
xinfo = dicominfo('Test_Image');
xinfo.PatientID = '123456';
xout = dicomwrite(x,'Test_Image','gray',xinfo);
I have tried copying the header to a new variable and editing the new one with out any success. I have also messed around with the 'CreateMode' option and still no results.
I just need to be able to add the 'PatientID' field to the header and write out the dicom image untouched.