Question: how to use imwrite matlab?
Answer: imwrite( A , map , filename ) writes the indexed image in A and its associated colormap, map , to the file specified by filename . If A is an indexed image of data type double or single , then imwrite converts the indices to zero-based indices by subtracting 1 from each element, and then writes the data as uint8 .