pcode does not run in matlab command line mode

1 view (last 30 days)
Hi there,
I have an issue about p file generated by the pcode. We have source control rules so I need to compile the source code to pcode. Here is the funny thing.
if I run
-------------------------------------------
/apps/matlab/bin/matlab < runModel.m
-------------------------------------------
it works. If I run
-------------------------------------------
/apps/matlab/bin/matlab < runModel.p
-------------------------------------------
It gives me an error
-------------------------------------------
>> ??? v00.00v00.00
|
Error: Unexpected MATLAB expression.
>> >> ??? ÀµZßµ
|
Error: The input character is not valid in MATLAB statements or expressions.
-------------------------------------------
Here it gets funnier, If i run matlab first then run p file
-------------------------------------------
>> bash-3.2$ /apps/matlab/bin/matlab
Warning: No display specified. You will not be able to display graphics on the screen.
< M A T L A B (R) >
Copyright 1984-2009 The MathWorks, Inc.
Version 7.9.0.529 (R2009b) 64-bit (sol64)
August 12, 2009
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
>> runModel.p
Name: Scenario1
-----------------------------------------------
Congratulations, that worked! but i cant ask a sales guy to run matlab and exec some code in unix!!!!!

Answers (1)

Walter Roberson
Walter Roberson on 29 Nov 2013
/apps/matlab/bin/matlab -r "try runModel; catch ME; end; quit"
The "<" operator in Unix is redirecting from an input file, almost as if what was in the input file was typed in response to command prompts. That can work for source code in text form, that that cannot work for .p files as those are not in source code format.
  3 Comments
Jan
Jan on 29 Nov 2013
The shown code works for a P-file already, so I do not understand your question in this comment.
Walter Roberson
Walter Roberson on 29 Nov 2013
Just give the name without the extension. .p files have priority over .m files with the same name.

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!