Navigating and extracting data from different folders

1 view (last 30 days)
I have a path of data which I would like to access various folders and various files within these folders. All the folders with the data I require to access are stored within the single folder ''Experimental data''.
Within the single folder, ''experimental data'' there is a number of participant folders labelled as follows:
Each H** folder which is the particpant number contains three seperate folders from different measurement devices. Namely research sensor, motionsense and vicon. For example if one were to open H01, three folders would be stored within it:
Within these three folders associated to each particiapnt there are a number of files which contain data of different activities carried out by the individual. For example the different tasks which are contained in the three files (for example if Vicon folder were opened) are listed as follows:
All tasks in each of the three folders vicon, motionsense and researchdevice are labelled in the same format. Each of the three folders contain the same files, with the same activities however, the data has just been collected from the specific device.
I would like to be able to compare each individual task file, T01 for instance for all H**files (the different participants) for each of the three measuremnet devices which have their data stored in the three seperate files (vicon, motionsense and research device).
In other words I would like to be able to read in the data for a specific task (specified by user) for all three measuremnet systems (vicon, motionsense and research device) for all participants (All H** folders).
I was able to access data for each participant seperately but I am unsure how to collate all the tasks to be able to compare the same task but carried out by different particpants.
Any help is hugely appreciated.
Please let me know if any clarity needs to be provided, or if existing code would be helpful?
Thanks again,
Stephen23 on 13 May 2022
Edited: Stephen23 on 13 May 2022
1 * : matches any number of characters.
2 * : matches any number of subdirectories.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 13 May 2022
You can either use dir with double stars as @Johan Pelloux-Prayer mentioned in the comment above, or you can use a file data store fileDatastore
Those will get you all the file names in a convenient structure. From there you can use functions like ismember or contains to select certain files for comparison or analysis.

More Answers (0)


Find more on Test and Measurement in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by