Open results file via standalone application

1 view (last 30 days)
I created an application using appdesigner. The application reads certain inputs from an excel file, then makes some calculations, and then writes the results of those calculations in another excel file (let's call it the "results" file). It also generates some plots and stores them as images (.jpg) in a folder of my choice. I have programmed a button in the app so that when I click it, I open the "results file" just created. I also programmed another button to open a windows folder (a folder in the windows environment) from which I see and open whatever plot I want (the ones saved as .jpg)
The app works as a charm, however, when I compile it to have a standalone version, I can't open these files.
Now, if I make sure the files are included when I'm compiling the application, then I am able to open the files with the standalone version, however, I would not be opening the "fresh" result files recently created, instead, I always open whatever file was in the directory at the moment of compilation.
I use the function winopen to open both, the excel files and the folder in windows.
Something similar happened with the input excel file, but I managed to find a solution. I changed its name before compiling (from "input file" to "input file_1"). Then compiled it. Then changed the name back to "input file" which is what my scripts are going to look for.
So, how can I open an external file with a standalone app if the file is not hardcoded or compiled with the app??
Thanks

Accepted Answer

Mohammad Sami
Mohammad Sami on 22 Aug 2020
Can you share the portion of your code that is opening the file / folder. The best option is to use full path to file and folder. You can construct the full path using the fullfile function. In a compiled application the function pwd will return either the folder containing the exe folder or the folder which contained the shortcut to the exe.
  4 Comments
Jose Garcia
Jose Garcia on 26 Aug 2020
Thank you Mohammad, using "pwd" worked perfectly

Sign in to comment.

More Answers (1)

Moch Arief Albachrony
Moch Arief Albachrony on 20 Nov 2023
Edited: Moch Arief Albachrony on 20 Nov 2023
Hello, I have similar question. I build the app standalone. In this time the calculation is running until finish. The result of calculation is in excel file (.xlsx).
However, I could not open my result from this calculation.
In the script of app builder matlab, I use command
winopen ResultCenter.xlsx
for open the file.
Could you please help me to solve this problem?
Thank you

Categories

Find more on Environment and Settings 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!