3

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?

Isak Baizley
  • 1,722
  • 4
  • 16
  • 21

1 Answers1

3

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,

uiimport opens 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 struct S.

So, just set

uiimport('-file');

as the button's callback.

Community
  • 1
  • 1
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147