How to update a frame from inside a tif file?

I want to update an frame from a tif file.The code below does not update the frame, but attach one more frame in the end.

afn = 'D:\QMDownload\7\colin\DRFP.TIF';
info = imfinfo(afn);
num_imagesZ = numel(info);
% how to update the second frame only
secondFrame =   imread(afn, 2, 'Info', info);
secondFrame_update = SecondFrame *0.34;
% this command doea not update, but stitch one more frame in the end.
imwrite(secondFrame_update,afn,'tif', 'Compression', 'none','WriteMode','append');

Is ther a way to update only a specific frame?
I do not want to re-write the whole stack just in order to update a frame only.

I don’t think it is possible, with imwrite function you can write a new file or append an image to the existing stack. If you want to have direct write to sub-section of your image stack you should use some other formats or if you want to stick with TIFs save them as sequence of 2D files.