MATLAB: Naming figures with existing filename

imagesMATLABnaming figuresregexpi

Hello Community,
I am having trouble getting the naming of my figures right. What I want to do is use part of a variable that contains an existing file name. For example: baseFileName = IMG_1234.jpg, and I want the title for the subsequent figure to read as, 'RGB 1234'. I have tried various iterations of code, an example of which is:
figure('name', 'RGB (regexpi(baseFileName, (?<=IMG_)\d+', 'match', 'once'))', 'numbertitle', 'off');
but obviously the section referring to 'regexpi(baseFileName,…etc.' would also appear in the title which is not what I want. The regexpi line of code has worked sucessfully elsewhere so I know this is correct, but I'm struggling to insert it in to the correct part of naming the figure.
This is for a script that will be run a few times using different images and I want to store the images after with their correct ID in the title for future reference.
So, can anyone offer some useful advice please?
Regards,
10B.

Best Answer

Perhaps this might works?
figT = ['RGB ' (regexpi(baseFileName, (?<=IMG_)\d+', 'match', 'once'))];
figure('name', figT, 'numbertitle', 'off');