Standalone Application uses Excel Sheet Template and writes in it, cant find it path

My Code uses a Excel Sheet Template and fills cells with calculatet varaibles using writetable(). I use uiputfile() to give the user the choice what name and where to save his file. Running the Code in Matlab works perfect but using it as a Standalone Application I cant open the new saved file. Excel gives me the error: Can`t find path to file, it mus be renamed, used by another programm or deleted.
I am new to Matlab and happy for any tipps and criticism. Can't help myself.
function ReportButtonPushed(app, ~)
[file,path] = uiputfile('*.xls', 'Fileselector');
fullfilepath = fullfile(path,file);
copyfile("Protokoll_Template.xls",fullfilepath);
...

7 commentaires

By standalone, do you mean you deployed your matlab code to executable?
Yes, I used the Application Compiler.
Is excell able to open the Protokoll_Template.xls which is the source in copyfile().
the problem is I don't know what exactly is going wrong, no clue - no error message
I can't test the code in matlab compiler because everything works perfect but as a .exe I cant open the result file and get a error sound while pressing the button.
Something wrong with the way I am using deploytool?
Has the exe terminated by the time you try to open the file in excel?
yes i always wait. After trying different things I'm now sure something is wrong with my fullfile path. Windows cant find the created path?
The '\' are correct and the path of the created result file brings me to the correct folder but it is not seen and the settings say the its empty.

Connectez-vous pour commenter.

Réponses (1)

Hi Evmi,
I understand that you are experiencing an error message when running the mentioned code in a standalone application created using Application Compiler.
I faced a similar issue in the past, but I was able to resolve it by using 'uigetfile' instead of 'uiputfile'.
Please try replacing the 'uiputfile' function with 'uigetfile' in your code and it should resolve the error.
For additional information on 'uigetfile' please refer to the following documentation:
I hope this helps!

Catégories

En savoir plus sur MATLAB Compiler dans Centre d'aide et File Exchange

Produits

Tags

Question posée :

le 18 Nov 2022

Réponse apportée :

le 29 Août 2024

Community Treasure Hunt

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

Start Hunting!

Translated by