Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
strange compiler behaviour

Subject: strange compiler behaviour

From: Vihang Patil

Date: 20 May, 2008 16:54:03

Message: 1 of 3

Hello
I have observed a strange behaviour in the compiled
application and I am really stuck at this one.

I have created a main gui file with many sub functions,
and sub directories containing sub functions.
I compile my application in this fashion

mcc -m koncheck -a user.png -a settings.png -a login.png -
a exit.png -a reference_image.jpg -a test_image.jpg -a
koncheck.kon -a ./INDICA_KIT_FACIA -a ./ICML_S41029_56 -
a ./A-S41022_25 -a ./X-1 -a ./PMO -a ./A-S41017

Let me brief you on what I am doing.
There are sub directories in my main Directory like
INDICA_KIT_FACIA, ICML_S41029_56, A-S41022_25, X-1 , PMO
and A-S41017.
Now all these sub - directories contain code which have
similar "mfile names" but differ slightly from each other
in coding.

When I run the code in development code, I fetch the code
in the specific directory and return back to my original
working directory.

But when I do the same in compiled application and I want
to fetch some information say from A-S41022_25, strangely
enough somehow in the compiled application it searches for
the m-file which is in INDICA_KIT_FACIA.

I had a hard time to understand that, but eventually
figured it out that if I change the mcc statement where -
a ./A-S41022_25 would come before -a ./INDICA_KIT_FACIA
like;

mcc -m koncheck -a user.png -a settings.png -a login.png -
a exit.png -a reference_image.jpg -a test_image.jpg -a
koncheck.kon -a ./A-S41022_25 -a ./A-S41017 -
a ./INDICA_KIT_FACIA -a ./ICML_S41029_56 -a ./X-1 -a ./PMO

Notice in the above mcc statement, the -a./A-S41022_25 is
placed before -a./INDICA_KIT_FACIA.
Now if I call anything from S41022_25 then it works fine,
but now I face problems if I have to call m file from -
a ./INDICA_KIT_FACIA.

I hope I am able to put in my problem correctly.
Is there something wrong in my mcc statement?
Please guide?
Vihang

Subject: strange compiler behaviour

From: Ashish Uthama

Date: 20 May, 2008 20:50:52

Message: 2 of 3

Could you check the extracted directory to see the contents? do all the
files exist?

> fetch the code
Could you please elaborate?

And why are you having to including the M-files in the subdirectories
using -a? (eval statements?)

You could also try displaying the 'path' and outputs of the 'which'
command to further debug the compiled application.

On Tue, 20 May 2008 12:54:03 -0400, Vihang Patil <vihang_patil@yahoo.com>
wrote:

> Hello
> I have observed a strange behaviour in the compiled
> application and I am really stuck at this one.
>
> I have created a main gui file with many sub functions,
> and sub directories containing sub functions.
> I compile my application in this fashion
>
> mcc -m koncheck -a user.png -a settings.png -a login.png -
> a exit.png -a reference_image.jpg -a test_image.jpg -a
> koncheck.kon -a ./INDICA_KIT_FACIA -a ./ICML_S41029_56 -
> a ./A-S41022_25 -a ./X-1 -a ./PMO -a ./A-S41017
>
> Let me brief you on what I am doing.
> There are sub directories in my main Directory like
> INDICA_KIT_FACIA, ICML_S41029_56, A-S41022_25, X-1 , PMO
> and A-S41017.
> Now all these sub - directories contain code which have
> similar "mfile names" but differ slightly from each other
> in coding.
>
> When I run the code in development code, I fetch the code
> in the specific directory and return back to my original
> working directory.
>
> But when I do the same in compiled application and I want
> to fetch some information say from A-S41022_25, strangely
> enough somehow in the compiled application it searches for
> the m-file which is in INDICA_KIT_FACIA.
>
> I had a hard time to understand that, but eventually
> figured it out that if I change the mcc statement where -
> a ./A-S41022_25 would come before -a ./INDICA_KIT_FACIA
> like;
>
> mcc -m koncheck -a user.png -a settings.png -a login.png -
> a exit.png -a reference_image.jpg -a test_image.jpg -a
> koncheck.kon -a ./A-S41022_25 -a ./A-S41017 -
> a ./INDICA_KIT_FACIA -a ./ICML_S41029_56 -a ./X-1 -a ./PMO
>
> Notice in the above mcc statement, the -a./A-S41022_25 is
> placed before -a./INDICA_KIT_FACIA.
> Now if I call anything from S41022_25 then it works fine,
> but now I face problems if I have to call m file from -
> a ./INDICA_KIT_FACIA.
>
> I hope I am able to put in my problem correctly.
> Is there something wrong in my mcc statement?
> Please guide?
> Vihang

Subject: strange compiler behaviour

From: Vihang Patil

Date: 21 May, 2008 05:15:06

Message: 3 of 3

"Ashish Uthama" <ashishu@ece.ubc.ca> wrote in message
<op.ubgz62exxwvkfj@uthamaa.dhcp.mathworks.com>...
> Could you check the extracted directory to see the
contents? do all the
> files exist?
>
> > fetch the code
> Could you please elaborate?
>
> And why are you having to including the M-files in the
subdirectories
> using -a? (eval statements?)
>
> You could also try displaying the 'path' and outputs of
the 'which'
> command to further debug the compiled application.
>

Hello Ashish

1. Yes, I have checked the extracted CTF directory, in my
case its koncheck_mcr and it contains all the sub-
directories that I have specified in the mcc command along
with all the m-files in it.

2. Since I am calling the sub function which are in the
sub-folders/directories, I am using the pushd() and popd()
functions which are found on the fex here
(http://www.mathworks.com/matlabcentral/fileexchange/loadFi
le.do?objectId=8103&objectType=file).
By "fetch" I meant, I jump from my current working
directory to the sub-directory using pushd(), execute the
code present in that directory and again use popd to come
back to my root directory.

3. The reason I am using -a./ to include my sub-
directories and all the m-files in it is because,
initially I just tried using
mcc -m koncheck -a user.png -a settings.png -a login.png -
a exit.png -a reference_image.jpg -a test_image.jpg -a
koncheck.kon. Please note that the -a <parts> are not m-
files but supporting files needed like jpg's and other
files
But somehow the compiler does not compile all the code
present in the sub-directories and gives me an error after
I have issued a pushd().
Hence I had to use -a ./INDICA_KIT_FACIA -
a ./ICML_S41029_56 - a ./A-S41022_25 -a ./X-1 -a ./PMO -
a ./A-S41017 in my mcc command.
This compiles all the code and when I execute koncheck.exe
I see that under koncheck_mcr all this sub-directories are
present. But then I get the problem which I have discussed
in my initial post.
Note All my sub-directories have same m-file names but
each m-file is different.
ex: If INDICA_KIT_FACIA contains abc.m then A-S41022_25
also contains abc.m, but they differ slightly in coding. I
would not like to change the file name as then it would be
really cumbersome process and then I would really loose
track while programming.
In Matlab development mode,when I use pushd() and popd(),
it goes correctly to the specific sub-directory, executes
the code within that directory and then comes back using
popd().
But in the compiled application depending upon how I have
placed the directories during my "mcc command" like
say mcc -m koncheck.m -a ./INDICA_KIT_FACIA -a ./A-
S41022_25 where INDICA_KIT_FACIA comes before S41022_25
then, while the code is being executed and I want to
execute some code present in the S41022_25 then it does go
to that directory("I have put a text box in my gui which
displays the current directory - for debugging"). It goes
to S41022_25 but does not execute abc.m file present in
that directory,but executes the code present in
INDICA_KIT_FACIA.
Why so?

4. s = which('koncheck')
C:\work\Mindarika\KonCheck for Safari Indica PMO X-1
\LabJack 172225 version 4\koncheck.m

Please guide
Vihang

I have a feeling that probably the compiler must be
placing all the directories in its compiled path and even
though the directory in which the code is present opens
up, but the compiler does not give preference to the code
present in it and searches for the m file in its path
first.
Just a hunch. If it is so? what could be the workaround?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us