Read files from a different directory in standalone applications
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
Please help me with the following:
I create a standalone executable with Application Compiler App (I am using R2017a).
Then I install the application in Program Files.
To run the Application (namely Model_A), I go to the Command Prompt and type:
application\Model_A
Model_A starts to run and read files from the directory that is installed in Program Files.
How can read files from another directory, for example, C:/users/user1/Desktop/Folder1?
should I use a command in command prompt that redirects Model_A from Program files to Folder 1?
Thank you.
Best,
Pavlos
댓글 수: 0
채택된 답변
KL
2017년 10월 21일
You need to modify your Model_A so that it asks the user to select a directory to read the files from. That way, you'll give the user the freedom to choose any folder he/she wants.
folder_name = uigetdir
This command opens up a dialogbox to let the user browse through explorer to select a folder. You can write it in one of the scripts/function which reads the files from the folder, like
folderInfo = dir(folder_name);
댓글 수: 4
Adi Purwandana
2023년 2월 25일
This won't be working for a standalone app. It may work before you convert it into standalone app. For me, since I haven't got yet the solution, I copy the app into my project folder to operate it.
추가 답변 (1개)
Birdman
2017년 10월 19일
You can set your directory to a file which contains both Program Files and Folder1.
댓글 수: 5
Birdman
2017년 10월 21일
application\Model_A "C:/users/user1/Desktop/Folder1"
When you do this, the spacing between modelA and "C... gives a command that application\Model_A is a function and the next statement will be its input. So it is invalid that you try to write like that. Use
cd
command for changing the directory. Let me know what happens.
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!