Skip to content

xiangruili/uiFileDnD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Drag and Drop OS file/folder(s) into Matlab figure/uifigure

View uiFileDnD on File Exchange

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

In the callback, full file/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:

target = uilistbox(uifigure, 'Position', [80 100 400 100]);
DnD_uifigure(target, @(o,dat)set(o,'Items',dat.names));

Note:

1. File DnD onto uifigure works only for Matlab R2020b or later.
2. File DnD works for uifigure and figure since R2025a.
3. File DnD works for Linux since R2025a.
4. Since R2025a, the following line needs to be added into startup.m file:
   try addprop(groot, 'ForceIndependentlyHostedFigures'); catch, end

About

Enable file DnD onto Matlab uifigure

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages