I want to ask quite simple question. I'm writing function converting raw image to bmp. Function name is raw2bmp() Now say I want to work with file LENA.raw so I type my function raw2bmp('LENA.raw'). My function produces output bmp image. I want it name LENA.raw.bmp. So the question is how to get file name as an array of symbols?
Add a comment
|
3 Answers
You can use sprintf() to format your string, like this:
file_to_save = sprintf('%s.bmp', input_file);
Then you can save the result to file_to_save.
2 Comments
Mykola Servetnyk
I just posted easier way. Sorry to bother.
herohuyongtao
@MykolaServetnyk I prefer to use
sprintf(), especially when I want my file name like file_0005.bmp, then I can simply use sprintf('file_%04d.bmp', 5).