Uigetfile returns zero without opening window
3 views (last 30 days)
Show older comments
Hi all,
I am using uigetfile in a GUI I designed in the AppDesigner. After a couple of times of running the GUI, running other scripts, or using the debugger, I always get to the point where the uigetfile returns 0 without opening a selection window.
The only solution to work around this so far is to restart MATLAB every time which is quite annoying. Also I haven't managed to determine after which point this starts to happen.
I could post a working example, but in the simplest of cases, the easiest way to test that is by typing uigetfile in the command window, which will either work/not work as I described above.
Below is my MATLAB version running in MacOS Monterey 12.4
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.12.0.1884302 (R2022a)
MATLAB License Number: xxxxxxx
Operating System: macOS Version: 12.4 Build: 21F79
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.12 (R2022a)
Simulink Version 10.5 (R2022a)
Control System Toolbox Version 10.11.1 (R2022a)
Curve Fitting Toolbox Version 3.7 (R2022a)
Database Toolbox Version 10.3 (R2022a)
Datafeed Toolbox Version 6.2 (R2022a)
Deep Learning Toolbox Version 14.4 (R2022a)
Fuzzy Logic Toolbox Version 2.9 (R2022a)
Global Optimization Toolbox Version 4.7 (R2022a)
Image Acquisition Toolbox Version 6.6 (R2022a)
Image Processing Toolbox Version 11.5 (R2022a)
Instrument Control Toolbox Version 4.6 (R2022a)
MATLAB Coder Version 5.4 (R2022a)
MATLAB Compiler Version 8.4 (R2022a)
MATLAB Compiler SDK Version 7.0 (R2022a)
MATLAB Report Generator Version 5.12 (R2022a)
Mapping Toolbox Version 5.3 (R2022a)
Model Predictive Control Toolbox Version 7.3 (R2022a)
Motor Control Blockset Version 1.4 (R2022a)
Navigation Toolbox Version 2.2 (R2022a)
Optimization Toolbox Version 9.3 (R2022a)
Parallel Computing Toolbox Version 7.6 (R2022a)
Partial Differential Equation Toolbox Version 3.8 (R2022a)
Predictive Maintenance Toolbox Version 2.5 (R2022a)
Robust Control Toolbox Version 6.11.1 (R2022a)
Sensor Fusion and Tracking Toolbox Version 2.3 (R2022a)
Signal Processing Toolbox Version 9.0 (R2022a)
Simulink Check Version 6.0 (R2022a)
Simulink Coder Version 9.7 (R2022a)
Simulink Compiler Version 1.4 (R2022a)
Simulink Control Design Version 6.1 (R2022a)
Simulink Coverage Version 5.4 (R2022a)
Simulink Design Optimization Version 3.11 (R2022a)
Simulink Design Verifier Version 4.7 (R2022a)
Simulink PLC Coder Version 3.6 (R2022a)
Simulink Report Generator Version 5.12 (R2022a)
Simulink Test Version 3.6 (R2022a)
Statistics and Machine Learning Toolbox Version 12.3 (R2022a)
Symbolic Math Toolbox Version 9.1 (R2022a)
System Identification Toolbox Version 9.16 (R2022a)
>>
3 Comments
Bruno Luong
on 11 Jul 2022
Edited: Bruno Luong
on 11 Jul 2022
Just a wild guess but 0 is normally returned when user clicks on close button. May be MATLAB or OS (I don't know Mac OS at all) has a stacks of callback events. You might try to put
drawnow
before uigetfile to clear the pending pending callback.
You might also want to try to set the properties of the parent GUI component 'BusyAction' to 'drop' and 'Interruptible' to 'off'.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!