How can I create an executable file that have an input that change in each run?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I want to create .exe for this simple code:
load text.txt
A=text(:,1);
d=A(1,1);
H=A(2,1);
T=A(3,1);
disp(d);
disp(H);
disp(T);
I use mcc -m func.m -a 'E:/.../directory that contain text file'
when I'm creating .exe file, text file contains: 1 2 3
and after running executable file,it shows this result: 1 2 3
but when I change the text file: 4 5 6
executable file again shows: 1 2 3
what should I do to update this text file in each run of .exe file, when I'm creating .exe.
of course this a simple example and I need it in another complicated code.
I'm beginner, I searched and I couldn't find the similar problem
Thanks in advance.
채택된 답변
Friedrich
2013년 5월 21일
Hi,
In the case you wan't an alterated input file do NOT embed it into the CTF. At startup the MCR checks if the extracted CTF content changed, if so it reextracts the CTF which leads to overwriting the file and you get back the initial values. Its better to place an input file next to the exe and determine at runtime the path to it:
This will give the desired result.
So basically instead of load text.txt do
load(fullfile(getcurrentdir,'text.txt'))
and place that text.txt in the same folder as your exe.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!