Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
xlsread in Matlab Executable

Subject: xlsread in Matlab Executable

From: Alaa Elwany

Date: 17 Jan, 2012 02:25:08

Message: 1 of 1

Hi,

I have an M File that starts with importing some data from Excel, as follows:

a = xlsread('Myfile.xlsx');

I write the file without the path, then just make sure that the Excel file is placed within Matlab's working directory.

Now, I am creating a stand alone executable from this M File. This .exe will be run on a computer that doesn't even have Matlab installed on it, so there is no "working directory" to set!
How do I make sure that the data is read from the file Myfile.xlsx placed in the same folder where the executable is? If I keep it to:

a = xlsread('Myfile.xlsx');

Sometimes it runs well, sometimes it gives an error "xlsread cannot open Myfile.xlsx". Apparently, it doesn't necessary go and look for Myfile.xlsx in the same folder of the executable.

Any input? Is there some (generic path) that I can put to ensure xlsread will search for the file in the same folder where the executable is saved?

Thanks alot,

Alaa

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us