MATLAB: How to make a file .mat as a function input and load it inside the function

#.mat #input #function

Hey everyone
I am developping a function and i need a A.mat as an infile input of the function B , inside the function i hav to do file load , and to say that the function and the A.mat are in the same directory. so the alogorithme would be like thise
function B(filemat)
load filemat
thank you

Best Answer

data = load(filemat);
Now the variables you need will each be fieldnames of the struct data