f



Matlab comiler and simple matlab function

I am trying to create an exe from a matlab function which doubles the
number you give it.

matlab function: test.m

function [output] = test (number)
%return double the input number
output = 2*number;
disp(output);

run matlab compiler at command line with:
mcc -mv test.m

with the resulting exe: test.exe

However when I run it at DOS prompt:
test 1
I am returned a value of 98.  I thought that maybe this was some octal
description of the output, but 98 oct is not 2 decimal.

Some other results it returned:
C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
\test_dll_2>test 2
   100

C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
\test_dll_2>test 4
   104

C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
\test_dll_2>test 5
   106

C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
\test_dll_2>test 10
    98    96

Do you have any ideas what might have happened?
Also note that the exe worked properly as %errorlevel% was 0 after
running

Thanks
ALex
0
confused2
12/1/2010 10:14:46 AM
comp.soft-sys.matlab 211266 articles. 20 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
1036 Views

Similar Articles

[PageSpeed] 19

confused2 <aesbrown@hotmail.com> wrote in message <999470c2-d65e-42a0-8445-f334da2f077c@n32g2000pre.googlegroups.com>...
> I am trying to create an exe from a matlab function which doubles the
> number you give it.
> 
> matlab function: test.m
> 
> function [output] = test (number)
> %return double the input number
> output = 2*number;
> disp(output);
> 
> run matlab compiler at command line with:
> mcc -mv test.m
> 
> with the resulting exe: test.exe
> 
> However when I run it at DOS prompt:
> test 1
> I am returned a value of 98.  I thought that maybe this was some octal
> description of the output, but 98 oct is not 2 decimal.
> 
> Some other results it returned:
> C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
> \test_dll_2>test 2
>    100
> 
> C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
> \test_dll_2>test 4
>    104
> 
> C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
> \test_dll_2>test 5
>    106
> 
> C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work
> \test_dll_2>test 10
>     98    96
> 
> Do you have any ideas what might have happened?
> Also note that the exe worked properly as %errorlevel% was 0 after
> running
> 
> Thanks
> ALex



Hi Alex,

it is the expected behabior.
In deployed mode , if you want to pass arguments , use str2num with isdeployed.
It is explained here:
Passing Arguments to and from a Standalone Application
http://www.mathworks.com/help/toolbox/compiler/f13-1005831.html#f13-1006802



Aurélien
http://blog.developpez.com/matlab4geek/
http://www.mathworks.com/help/toolbox/compiler/f13-1005831.html#f13-1006802
0
Aurelien
12/1/2010 10:28:05 AM
Reply: