MATLAB: How to get corresponding file in another folder

dir

In one of my folders there are files like "IGN_A.txt", "IGN_B.txt", "IGN_C.txt"………
In another folder there are corresponding files like "sim_IGN_A.txt", "sim_IGN_B.txt", "sim_IGN_C.txt"………….
Each of this file contains two columns of same size. How can I create a matrix where two column data from "IGN_A.txt" and two column data from "sim_IGN_A.txt" will be stored side by side. Same thing will be applied to other files.

Best Answer

You can include path information in your load command. If you know the path, use that along with the filename to open both files. From there, just load the data from both files, and then create the two matrices combining the data as you wish.
Look into fullfile to help you assemple the full path and filename.