File Exchange

image thumbnail


version 2020.10.04 (3.06 KB) by Xiangrui Li
Drag and Drop OS file/folder(s) into uifigure


Updated 07 Nov 2020

From GitHub

View Version History

View license on GitHub

This single file implementation can set up a callback fired when files and/or folders are dropped onto a uifigure component.

In the callback, the full file and/or folder names are captured for user to decide the action. Ctrl and Shift key status during the drop event are also reported.

Example to drop file/folder into uilistbox:

DnD_uifigure(uilistbox(uifigure), @(o,dat)set(o,'Items',dat.names))

Cite As

Xiangrui Li (2021). uiFileDnD (, GitHub. Retrieved .

Comments and Ratings (4)


Very neat utility!! Excellent.

Xiangrui Li

Hi Lei Wang,
When did you experience the crash, when you call DnD_uifigure, drag into uifigure/component, or drop onto a component?

Nice: works with Appdesigner at Maltlab 2021a
Issue: This seem to cause Matlab randomly crash to exit without any messages. Maybe need a proper way to remove residuals after app exist and the function lifetime?

This seem to cause Matab to random crash to exit without any notice

MATLAB Release Compatibility
Created with R2020b
Compatible with R2020b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!