MATLAB: How to retrieve a word from a filename matlab function name:"rgb_watermark_lena.jpg" I want to retrieve only "lena" word from file It should be "lena.jpg" Can any one sort out this problem Best Answer name = 'rgb_watermark_lena.jpg';name(end-7:end-4)ans =lenaYou probably get the point :) Related SolutionsMATLAB: Functions renaming answers from variable, also saving cropped image as file filename = 'A.jpg';number = 1;[fPath, fName, fExt] = fileparts(filename);newfilename = fullfile(fPath, sprintf('%s%d%s', fName, number, fExt));Then use imwrite with the new file name. MATLAB: How to conver folder (images) from GRB to Gary and save them in Output folder with the same original names You need to use fullfile() to make a name with the output folder prefixing the base file name:outputFileName = fullfile(outputFolder, filename);imwrite(img, outputFileName);See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F Related QuestionWhat should i do to make both images of same sizeImporting an image into a variable from databaseIam browsing images from a folder using GUI Matlab. Now I want create a next button so that i can obtain all pics by pressing next. How to do that
Best Answer