MATLAB: Writing Image Names to text file

data importfilefopenfprintffscanfimageread datatext file

I have a file with images(Filename) with format:
vi_xxxxx
where, 1<i<5 and xxxxx varies between 00000-01164 ,different for each i.I have 4 images in each row. I want
to create a text file with these images' names.
For example:
v0_00000
v5_00001
v5_00002
........
etc
Any idea of how this can be done?

Best Answer

fid = fopen('names.txt','w');
fprintf(fid,'%s\n',imagenames{:});
fclose(fid);
where imagenames is your name of images.