Reading microsoft excel spreadsheets not within the 'Current Folder' directory in Matlab working environment?

60 views (last 30 days)
I am familiar with the xlsread functions, however I understand the file must be within the current path/folder that matlab is working in. Is it possible to load spreadsheet data from a random location on the drive using the load command? I have come accross the uigetfile function which is useful since I have just started working with GUIs (GUIDE etc):
[filename1, pathname1, FilterIndex] = uigetfile;
When I load the data would it matter to us the path or filename?
Thanks for any advice, Al

Answers (1)

Srinivas on 4 Apr 2013
you can give your full path in xlsread some thing like this
data = xlsread('C:\Users\username\myfile.xlsx')
Walter Roberson
Walter Roberson on 20 Jan 2017
Edited: Walter Roberson on 20 Jan 2017
Spaces within quoted strings do not terminate commands (except indirectly; you have to be careful if you use dos() or system() or unix() )
Historically, though, some Simulink related toolboxes had problems with directories that had spaces or special characters in the name.

Sign in to comment.


Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!