? You do not have any input named "names2" and you do not create a variable by that name.
[gait,stair up,stair down] is not valid syntax on the left side of "=" in a "function" declaration. It is not permitted in MATLAB to have variables with spaces in the name.
I notice those happen to be the same as the strings you pass as file names for xlswrite. Are you attempting to return the names of the files, or are you attempting to somehow return the files themselves (perhaps in binary form) ?
For xlswrite() it is better to supply the file extension, such as
gaitfile = 'gait.xlsx';
xlswrite(gaitfile, .....)