Integrate the file selection app into any Matlab app or use this app as a stand-alone file selector and export the data to the workspace.
- Download and unzip the file
- Add app folder to Matlab path
Stand alone app:
You can use the app as a stand-alone app as a file selector: Pass the command:
If Matlab doesn't recognize the function (Unrecognized function or variable 'FileSelectorApp'.), then make sure that you added the app to the Matlab path
Integrate app into other apps:
- Open the app into which you wish to integrate the FileSelectorApp with the app designer
- Add a public property
- Past the next line in place of the new property This new property has three fields: a. file_list : table with two columns - filenames and variableind (which hold the index of a specific variable, relevant for mat files) b. valid_flag: boolean - true if the app successfully loaded files c. last_source_folder: char - the path to the last loaded folder so that next time it will load that folder automatically
app_output = struct('file_list',,'valid_flag',false, 'last_source_folder','') % Connect handle to outer app here
h = FileSelectorApp(app); waitfor(h); % This will freeze you app until the FileSelectorApp is closed % Debug % disp(app.file_selector)
Uncomment the last line to debug or display the values.
- The property app_output will hold a table with the selected file paths
How to use
A. Filter parameters:
- "Matfile" StateButton and "Class name" field: If "Matfile" StateButton "On," then the app will load only the matfile that contains a variable of the class in the "Class name" field (double if empty). Here is where the 'variableind' variable in the 'file_list' table in the 'app_output' property is useful; it indicates the index of the variable in the matfile (the first one if there is more than one)
- "Search filter": Add a search filter to refine the loaded file, for example, "*.wav" to load only wav files or "June" to load the only files that contain the word "June."
B. Load files
- "Select folder" button: Open folder selection UI and load files from the folder
- "Include subfolder" StateButton: If "On" the extended search to subfolder as well, (effectively adds "**\" to the search filter)
- "Refresh folder" button: Reload the folder
C. Select files
The loaded files will be shown in the left table, select any number of files and transfer them to the select list on the right
D. Export file list
If the app was initiated as a stand-alone app, this action exports the table to the workspace and closes the app. If the app was initiated as an integrated element in another app, this action will update the app.app_output handle and close the app.
ytzhak goussha (2023). File slection app for Matlab (https://github.com/gutzcha/file_selection_app_for_matlab/releases/tag/v1.2), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
See release notes for this release on GitHub: https://github.com/gutzcha/file_selection_app_for_matlab/releases/tag/v1.2
See release notes for this release on GitHub: https://github.com/gutzcha/file_slection_app_for_matlab/releases/tag/v1.1