Matlab standalone executable deployment- error using phantom function

Hey, I am working on matlab R2009A on ubuntu 11.04. Using the deploytool, I generated a test package for a matlab code of mine. Afterwards, I installed MCR using the command
sudo ./MCRInstaller.bin
which installed it at /opt/MATLAB/MATLAB_Compiler_Runtime/. Now to run the program, I extracted the package and then ran the file run_test.sh using command
./run_test.sh /opt/MATLAB/MATLAB_Compiler_Runtime/v710/ 10 128
where 10 and 128 are the arguments to the main function in the package. It gives me the error as
??? Error using ==> phantom>parse_inputs at 107
Unknown default phantom selected.
Error in ==> phantom at 69
Error in ==> MLEM at 3
Images:phantom:unknownPhantom
MLEM is my main program and at line 3, I have used the phantom function as
i = phantom(SIZE)
SIZE is an input argument(=128 in this case)

回答 (3 件)

Titus Edelhofer
Titus Edelhofer 2012 年 5 月 4 日

2 投票

Hi Sabya,
just a guess: you know that input parameters to standalone applications are always passed as strings? This can be handled e.g. by
function myfunction(x,y)
if ischar(x)
x = str2double(x);
end
if ischar(y)
y = str2double(y);
end
Or using isdeployed instead of ischar ...
Titus

3 件のコメント

Kaustubha Govind
Kaustubha Govind 2012 年 5 月 4 日
Ah! Great catch Titus!
Sabya
Sabya 2012 年 5 月 5 日
I put the following statements in my code
if(ischar(SIZE))
SIZE=str2int(SIZE);
end
Still no use, same error crops up.
Titus Edelhofer
Titus Edelhofer 2012 年 5 月 7 日
Hi Sabya,
where does the str2int function come from? Or did you mean str2double? What I sometimes do in these cases: I add after the first line a
save c:\temp\inputVariables
so that all input variables are saved. Then run the compiled application. Then load in MATLAB the variables
load c:\temp\inputVariables
and call your MATLAB function with just these variables to see what happens ...
Titus
Titus

サインインしてコメントする。

Walter Roberson
Walter Roberson 2012 年 5 月 3 日

0 投票

You cannot pass just a size to phantom(). The first parameter must be either a string or an array.

8 件のコメント

Sabya
Sabya 2012 年 5 月 3 日
No, thats not true. The function phantom works perfectly when run the code normally from matlab command line.
Sabya
Sabya 2012 年 5 月 3 日
I mean that the command
i=phantom(256)
work perfectly storing a 256x256 image in i
Kaustubha Govind
Kaustubha Govind 2012 年 5 月 4 日
Does it work with 128 as the input argument when run in MATLAB? The error is coming from phantom>parse_inputs, and is not a standard MATLAB error, so it's hard to tell what could be going wrong without looking at your code. Perhaps putting some DISP statements in phantom>parse_inputs will help with debugging.
Sabya
Sabya 2012 年 5 月 4 日
the code woks fine when i execute it from matlab prompt as
MLEM(10,128)
Walter Roberson
Walter Roberson 2012 年 5 月 4 日
Passing only a size to phantom is not a documented syntax in R2009a.
http://www.mathworks.com/help/releases/R2009a/toolbox/images/index.html?/help/releases/R2009a/toolbox/images/phantom.html
Sabya
Sabya 2012 年 5 月 5 日
I don't have the license associated with my account; so i can't view the above page. But the code is working in my system perfectly from matlab command prompt.
Walter Roberson
Walter Roberson 2012 年 5 月 7 日
The R2009a documentation page is formatted differently than the current documentation page but contains the same information as the current (R2012a) documentation -- with no documented possibility of passing only a size.
If you insist on using undocumented behavior and your code fails, then we cannot be of assistance to you.
Titus Edelhofer
Titus Edelhofer 2012 年 5 月 7 日
Hi Walter,
don't know about R2009a, but in R2012a the doc contains the following "example":
% ph = phantom(256);
% figure, imshow(ph)
Titus

サインインしてコメントする。

Elie nasr
Elie nasr 2014 年 8 月 14 日

0 投票

Hello there, anyone would provide me an MLEM algorithm for image reconstruction? Thank you

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

質問済み:

2012 年 5 月 3 日

回答済み:

2014 年 8 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by