I'm working in a GUI in Matlab R2014b that uses some data from a txt file, so i want to call the 'Import Data' window to permit the user select the data from a file when pushing a button. Is there a way to do this?
The function uiimport is used for importing data interactively. This seems to be what gets called by Matlab's toolbar's "import data" button.
Excerpting from the documenatation,
uiimportopens a dialog to interactively load data from a file or the clipboard. MATLAB® displays a preview of the data in the file.
uiimport('-file')presents the file selection dialog first.
S = uiimport(___)stores the resulting variables as fields in the structS.
So, just set
uiimport('-file');
as the button's callback.
来源:https://stackoverflow.com/questions/29331836/matlab-calling-import-data-with-gui-button