First. you shouldn't be using addpath just to be able to load some data. addpath is intended to make code files visible, not data files. All the import functions can load data from any folder regardless of whether or not they're on the path. It's much better to pass the full path of the file to the the import function. With addpath you may end up importing a file with the same name but in a different folder than what you intended.
Secondly, why do assume that matlab is going to somehow guess that in the char vector 'EXP(user_input_exp)_SQ(user_input_squad)_Template.txt' it's supposed to replace the user_input_exp part by the variable of the same name, but not replace the Temp part by the value of a variable called Temp or even the a of Template by the value of a variable called a? Matlab doesn't yet have a mind reading toolbox, if you want to insert something from a variable into some text you have to tell it explicitly with functions such as sprintf, compose or by string concatenation and things like num2str.
So, here is how to code it:
root = 'C:\Users\Administrator\Dropbox (*******)\******* Team Folder\Matlab\RFID chip reader';
user_input_exp = input('Enter Experiment Number: ', 's');
user_input_squad = input('Enter Squad Number: ', 's');
filepath = fullfile(root, sprintf('EXPT%s', user_input_exp), user_input_squad, sprintf('EXP_%s_SQ%s_Template.txt', user_input_exp, user_input_squad));
assert(exist(filepath, 'file'), 'Selected Experiment number and squad number combination is not valid');
Mac_Templ = importdata(filepath);
Thirdly, importdata is the big gun of importing. If you actually know the type of file you're importing it would be better to use a more specialised import function (readtable or readmatrix maybe?). Your follow up code will assume a particular output from importdata but importdata will happily import any kind of file which may result in a completely different output than you expect. It's better to error at the import because the file is not in the expected format rather than for obscure reason later on because importdata imported the data in a different format.
Best Answer