Open results file via standalone application
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Mohammad Sami
2020-8-22
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 个评论
Mohammad Sami
2020-8-26
Another solution would be to use this answer to get the executable path. I have not tested it myself.
更多回答(1 个)
Moch Arief Albachrony
2023-11-20
编辑:Moch Arief Albachrony
2023-11-20
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!