Thank you Walter for your answer. Yes, compressionmode works perfectly, but I dont want to compress the dicom automatically. I want to compress it manually by writing my own code.
However, making all the pixel value of the original image as "0" (so I reduce the number of bits a lot in image), that doesn't reduce the size of the dicom file by calling dicomwrite(image,'newimage.dcm'). Why this happens?
If I want to compress a dicom in Matlab, should I always use the 'CompressionMode' ? Isn't it possible to use my own compression algorithm and write it without 'CompressionMode'?