modify the function addpath

how to modify the function addpath (), if before the compiled function can work, but once compiled addpath function () can not work
my code 1
addpath(fullfile(pwd,'namefoldel'))
inputdata % gui_files
my code 2
addpath(pwd,'namefolder')
[x,y]=function1(a,b) % function_file
[c,d]=function2(x,y) % function_file
my code 3
addpath(pwd,'namefolder')
addpath(fullfile(pwd,'namefoldel'))
system('nameexecutable.exe') % executable_file

 채택된 답변

Friedrich
Friedrich 2011년 7월 1일

1 개 추천

Since the MATLAB Compiler adds the functions1 and function2 to the ctf achieve with the folder structure like in MATLAB you don’t need an addpath in the deployed application. This is because in the deployed application the added folders are automatically added to the MATLAB path.
If your GUI files are normal m-files you don’t need an addpath. When you have created the GUI through using GUIDE you have to add the .fig as shared resources.

댓글 수: 6

pink
pink 2011년 7월 1일
i made gui
pushbutton1_calback(...)
addpath(fullfile(pwd,'namefoldel'))
inputdata % gui_files
pushbutton2_calback(...)
addpath(pwd,'namefolder')
[x,y]=function1(a,b) % function_file
[c,d]=function2(x,y) % function_file
pushbutton3_Callback(....)
addpath(pwd,'namefolder')
addpath(fullfile(pwd,'namefoldel'))
system('nameexecutable.exe') % executable_file
my problems at once compiled, the buttons can not work
Friedrich
Friedrich 2011년 7월 1일
you can use the isdeployed function to determine if you are running in MATLAB or in deployed mode, e.g
if ~isdeployed
addpath(pwd,'namefolder')
end
pink
pink 2011년 7월 1일
can not work, I can not call a gui in "namefolder".
I have a gui, the gui is connected with several sub-gui and some functions that are stored in folders to access it I use addpath. I have a problem when the gui was compiled, I can not access the sub-gui and these functions.
Friedrich
Friedrich 2011년 7월 1일
Make sure that all functions and GUIs which you are calling are visible to MATLAB during compiling. This means add all the paths to the MATLAB PATH before compiling. Or you can add all the functions and GUIs to the deploytool project. You have to "deactivate" the addpath function anyway so use the isdeployed function to do it.
pink
pink 2011년 7월 1일
whether such?
if ~isdeployed
addpath(pwd,'namefolder')
inputdata %gui file
else
inputdata %gui file
end
pink
pink 2011년 7월 1일
whether such?
if ~isdeployed
addpath(pwd,'namefolder')
inputdata %gui file
else
inputdata %gui file
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Standalone Applications에 대해 자세히 알아보기

질문:

2011년 7월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by