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:
Matlab comiler and simple matlab function

Subject: Matlab comiler and simple matlab function

From: confused2

Date: 1 Dec, 2010 10:14:46

Message: 1 of 2

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

Subject: Matlab comiler and simple matlab function

From: Aurelien Queffurust

Date: 1 Dec, 2010 10:28:05

Message: 2 of 2

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

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