Can a .exe created using Application compiler toolbox read input data from an Excel file each time it is executed?

1 view (last 30 days)
I have created a .exe file using the Application compiler toolbox and it reads the input data from an Excel file. The problem is that it reads the input data during the creation of the .exe file it saves this data forever, when I edit and change the input data the .exe remains calculating with the old input data. I need to know if there is a way to achieve this.
Thanks,
Jon
  5 Comments
Rik
Rik on 17 Nov 2020
GUIDE is not 'the best way' to create a GUI in Matlab. It is 'a way' at best, and it will be removed from a future release. For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Nov 2020
If you read from a fixed filename in your code, then MATLAB will take a copy of the file and will build it into the executable. It will be unarchived into a temporary directory when the executable archive is expanded, and can be read from and written to inside the temporary directory. If the temporary directory is deleted, then any updates to the file are lost, and the next time the archive is expanded the file will be back to what it was. See the documentation for ctfroot()
If you want to be able to update a file and have it "stick" then the updated file needs to live somewhere else. For example you can check the USERDRIVE and USERPATH environment variables to construct a path relative to the user home directory, and if the file is there then read it from there and otherwise read the one that got copied into the executable.

More Answers (0)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!