MATLAB Answers

How do you load a .txt file into your workspace filled with only numbers from a push button?

10 views (last 30 days)
Nicholas Cerean
Nicholas Cerean on 31 Mar 2016
Answered: Dave Behera on 4 Apr 2016
I've been using Uigetfile but I cant seem to get the data into the workspace.
  1 Comment
Geoff Hayes
Geoff Hayes on 31 Mar 2016
Nicholas - uigetfile will get the filename (and path). You would need to use (for example) csvread to read the data into a variable.

Sign in to comment.

Answers (1)

Dave Behera
Dave Behera on 4 Apr 2016
You can load a file from a GUI with multiple options. As Geoff mentioned above, use uigetfile to select your file and then use textscan, csvread,xlsread, etc to read it based on the type of file it is.
For loading .mat file, you can use uiopen directly to load all variables inside it:

Community Treasure Hunt

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

Start Hunting!