I can not open a file with Guide after compilation

2 Ansichten (letzte 30 Tage)
Mickael
Mickael am 13 Mai 2020
Kommentiert: Mickael am 14 Mai 2020
Good evening,
I would like to import/read a file within an application made with app designer (see a short example in attached file), however once I compile it with Application Compiler, it is not able to read it anymore. I have tried to put the file out or in the same folder as the application without success.
What do you believe I should do?
Thank you in advance,
Best regards,
Mickaël
  8 Kommentare
Walter Roberson
Walter Roberson am 14 Mai 2020
[FileName, PathName] = uigetfile('*.txt','Select a txt-file'); % choix du fichier à lire par l'utilisateur
wholefile = fileread(FileName); % read in entire file
That code would work if the file happened to be in the current directory. But when you compile an application, the default current directory is the temporary directory that the executable unpacks into; see the documentation for ctfroot() and https://blogs.mathworks.com/loren/2008/08/11/path-management-in-deployed-applications/
Mickael
Mickael am 14 Mai 2020
Thank you both of you for your comments.
@ Geoff, sorry, it is a truncated part of my main program and I forgot to remove all the useless lines to present my problem
@ Walter, I am going to look into it. Thanks

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by