MATLAB: How to input every file in a directory ending with .txt into the Matlab program while logged in through ssh

MATLAB

I have a script/program that compares two inputs. I'd like the first input to stay the same throughout. For the other input, I want it to take in every single file ending with .txt in a directory, and execute the program.
How can I do so?
I'm working through ssh, so I'm not sure if that changes anything.
Also, would this code to run through all the files be placed in the command window or in my script?

Best Answer

"every single file ending with .txt in a directory," &nbsp
Try
sad = permute( dir( fullfile( folderspec, '*.txt' ) ), [2,1] );
for s = sad
fullfile( folderspec, s.name )
end
Related Question