Hi,
You can save storage space by storing the zeros in the other two dimensions in order to save memory. As per your code, you can use the below code:
Hdr=zeros(size(imgHDR,1),size(imgHDR,2),3);
Hdr(:,:,1)=imgHDR;
hdrwrite(Hdr,'result.hdr');
Hope it will help.