I have two variables, A and B, which have a variable between them that creates a file name. e.g.
A*B.mat where * %// can be any number of digits
Obviously dir A*B.mat does not work, but I haven't the faintest on how to actually make it work.
I think you want this: concatenate the contents of
B with the string
'*' in between and
'.mat' at the end:
dir( [A '*' B '.mat'] )
You can use
dir( sprintf('%s*%s.mat', A, B ) );