<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903</link>
    <title>MATLAB Central Newsreader - mexCallMATLAB populating inputs</title>
    <description>Feed for thread: mexCallMATLAB populating inputs</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 19 Aug 2009 20:27:00 -0400</pubDate>
      <title>mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674340</link>
      <author>John Harrold</author>
      <description>Howdy folks,&lt;br&gt;
&lt;br&gt;
I had a class in C sometime in the previous century, but truth be told&lt;br&gt;
I never really understood pointers. I've recently come to a point&lt;br&gt;
where I need to call matlab m-files from some ode simulations I'm&lt;br&gt;
running, and I've been trying to incorporate the mexCallMATLAB&lt;br&gt;
function into these simulations. I've tried to create a simple example&lt;br&gt;
to figure this out. As an example I'd like to call the following m-&lt;br&gt;
file from within a mex function:&lt;br&gt;
&lt;br&gt;
&amp;lt;mymfile.m&amp;gt;&lt;br&gt;
function [output]=mymfile(input)&lt;br&gt;
&lt;br&gt;
output = input(1)+2*input(2)-input(3)^3 + input(4);&lt;br&gt;
&amp;lt;/mymfile.m&amp;gt;&lt;br&gt;
&lt;br&gt;
So if I call this from within matlab I get the following:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; mymfile([1 2 3 4])&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-18&lt;br&gt;
&lt;br&gt;
Now I've constructed the following mex file&lt;br&gt;
&lt;br&gt;
&amp;lt;mexfile.c&amp;gt;&lt;br&gt;
#include &quot;mex.h&quot;&lt;br&gt;
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray&lt;br&gt;
*prhs[] )&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;int nlhs1, nrhs1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;mxArray *plhs1[1], *prhs1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;prhs1 =  mxCreateDoubleMatrix(4, 1, mxREAL);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;/* how do I populate prhs1? */&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;nlhs1 = 1;  nrhs1 = 1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,&quot;mymfile&quot;);&lt;br&gt;
}&lt;br&gt;
&amp;lt;/mexfile.c&amp;gt;&lt;br&gt;
&lt;br&gt;
As the comment above indicates. I want to know how to go about&lt;br&gt;
populating the prhs1 with my input (in this case 1 2 3 4).  I&lt;br&gt;
apologize for the simple question here, I'm just at a loss with this.</description>
    </item>
    <item>
      <pubDate>Wed, 19 Aug 2009 22:31:20 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674370</link>
      <author>James Tursa</author>
      <description>You are making this particular example too hard. No need to make a copy of the input, just pass it on to the mexCallMATLAB as is. And no need to make a separate output variable, just use plhs directly. Try this:&lt;br&gt;
&lt;br&gt;
#include &quot;mex.h&quot;&lt;br&gt;
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray&lt;br&gt;
*prhs[] )&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;mexCallMATLAB(1, plhs, 1, prhs, &quot;mymfile&quot;);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; a=[1 2 3 4]&lt;br&gt;
a =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1     2     3     4&lt;br&gt;
&amp;gt;&amp;gt; mymfile(a)&lt;br&gt;
ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-18&lt;br&gt;
&amp;gt;&amp;gt; mymfilemex(a)&lt;br&gt;
ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-18&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Thu, 20 Aug 2009 00:16:50 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674392</link>
      <author>John Harrold</author>
      <description>On Aug 19, 6:31&#160;pm, &quot;James Tursa&quot;&lt;br&gt;
&amp;lt;aclassyguy_with_a_k_not_...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; You are making this particular example too hard. No need to make a copy of the input, just pass it on to the mexCallMATLAB as is. And no need to make a separate output variable, just use plhs directly. Try this:&lt;br&gt;
&lt;br&gt;
I'm making this example hard because it's what I'm actually going to&lt;br&gt;
have to do in my code. So I tried to provide a minimal example that,&lt;br&gt;
once my question is answered, will enable me to accomplish what I want&lt;br&gt;
to do. So to be a little more explicit:&lt;br&gt;
&lt;br&gt;
What syntax in C would allow me to populate the prhs1 array such that&lt;br&gt;
I could subsequently call the mexCallMATLAB function?</description>
    </item>
    <item>
      <pubDate>Thu, 20 Aug 2009 00:39:19 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674396</link>
      <author>James Tursa</author>
      <description>John Harrold &amp;lt;john.m.harrold@gmail.com&amp;gt; wrote in message &amp;lt;494fa8a2-72c1-4c6a-a599-69269928edd2@r27g2000vbn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What syntax in C would allow me to populate the prhs1 array such that&lt;br&gt;
&amp;gt; I could subsequently call the mexCallMATLAB function?&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;double a[] = {1, 2, 3, 4};&lt;br&gt;
&amp;nbsp;&amp;nbsp;double *pr;&lt;br&gt;
&amp;nbsp;&amp;nbsp;mxArray *plhs1[1], *prhs1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;int i;&lt;br&gt;
&amp;nbsp;&amp;nbsp;prhs1 = mxCreateDoubleMatrix(4, 1, mxREAL);&lt;br&gt;
&amp;nbsp;&amp;nbsp;pr = mxGetPr(prhs1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;for( i=0; i&amp;lt;3; i++ ) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pr[i] = a[i];&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;mexCallMATLAB(1, plhs1, 1, &amp;prhs1, &quot;mymfile&quot;);&lt;br&gt;
&lt;br&gt;
For readability, you might consider making plhs1 and prhs1 either both arrays or both pointers. That way using them for arguments in mexCallMATLAB would look the same instead of different as I have them above.&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Thu, 20 Aug 2009 01:03:22 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674401</link>
      <author>John Harrold</author>
      <description>On Aug 19, 8:39&#160;pm, &quot;James Tursa&quot;&lt;br&gt;
&amp;lt;aclassyguy_with_a_k_not_...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; John Harrold &amp;lt;john.m.harr...@gmail.com&amp;gt; wrote in message &amp;lt;494fa8a2-72c1-4c6a-a599-69269928e...@r27g2000vbn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; What syntax in C would allow me to populate the prhs1 array such that&lt;br&gt;
&amp;gt; &amp;gt; I could subsequently call the mexCallMATLAB function?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &#160; double a[] = {1, 2, 3, 4};&lt;br&gt;
&amp;gt; &#160; double *pr;&lt;br&gt;
&amp;gt; &#160; mxArray *plhs1[1], *prhs1;&lt;br&gt;
&amp;gt; &#160; int i;&lt;br&gt;
&amp;gt; &#160; prhs1 = mxCreateDoubleMatrix(4, 1, mxREAL);&lt;br&gt;
&amp;gt; &#160; pr = mxGetPr(prhs1);&lt;br&gt;
&lt;br&gt;
I think this is what I couldn't figure out.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; For readability, you might consider making plhs1 and prhs1 either both arrays or both pointers. That way using them for arguments in mexCallMATLAB would look the same instead of different as I have them above.&lt;br&gt;
&lt;br&gt;
Yeah, you're right.&lt;br&gt;
&lt;br&gt;
Thanks for your help this is exactly what I needed.</description>
    </item>
    <item>
      <pubDate>Thu, 20 Aug 2009 09:34:04 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674481</link>
      <author>oruganti murthy</author>
      <description>Dear James,&lt;br&gt;
I tried your recommendation and I am getting this strange result. Why?&lt;br&gt;
&lt;br&gt;
with regards,&lt;br&gt;
ramana&lt;br&gt;
**************************&lt;br&gt;
#include &quot;mex.h&quot;&lt;br&gt;
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;double a[] = {1, 2, 3, 4};&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;double *pr;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mxArray *prhs1,*output[1];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int i;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;prhs1 = mxCreateDoubleMatrix(4, 1, mxREAL);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pr = mxGetPr(prhs1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for( i=0; i&amp;lt;3; i++ ) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pr[i] = a[i];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mexCallMATLAB(1, output, 1, &amp;prhs1, &quot;mymfile&quot;);    &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;plhs[0] = output[0];&lt;br&gt;
}&lt;br&gt;
****************************&lt;br&gt;
function [output]=mymfile(input)&lt;br&gt;
output = input(1)+2*input(2)-input(3)^3 + input(4);&lt;br&gt;
*****************************&lt;br&gt;
&amp;gt;&amp;gt; mex demo2.c&lt;br&gt;
&amp;gt;&amp;gt; b=demo2()&lt;br&gt;
&lt;br&gt;
b =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-22&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; mymfile([1 2 3 4])&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-18</description>
    </item>
    <item>
      <pubDate>Thu, 20 Aug 2009 12:21:01 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674517</link>
      <author>John Harrold</author>
      <description>On Aug 20, 5:34&#160;am, &quot;oruganti murthy&quot; &amp;lt;omur...@yahoo.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Dear James,&lt;br&gt;
&amp;gt; I tried your recommendation and I am getting this strange result. Why?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; mex demo2.c&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; b=demo2()&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; b =&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &#160; &#160;-22&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; mymfile([1 2 3 4])&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &#160; &#160;-18&lt;br&gt;
&lt;br&gt;
Use &amp;lt;=3 in the for loop instead of strictly &amp;lt;3.</description>
    </item>
    <item>
      <pubDate>Thu, 20 Aug 2009 16:30:20 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674587</link>
      <author>James Tursa</author>
      <description>John Harrold &amp;lt;john.m.harrold@gmail.com&amp;gt; wrote in message &amp;lt;709f10a0-f1f0-4d97-b564-bcc3acee355f@l35g2000vba.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Aug 20, 5:34?am, &quot;oruganti murthy&quot; &amp;lt;omur...@yahoo.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Dear James,&lt;br&gt;
&amp;gt; &amp;gt; I tried your recommendation and I am getting this strange result. Why?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; mex demo2.c&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; b=demo2()&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; b =&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ? ?-22&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; mymfile([1 2 3 4])&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ans =&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ? ?-18&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Use &amp;lt;=3 in the for loop instead of strictly &amp;lt;3.&lt;br&gt;
&lt;br&gt;
Oops ... sorry about that.&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Fri, 21 Aug 2009 00:29:03 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#674721</link>
      <author>oruganti murthy</author>
      <description>Thank you all very much folks.&lt;br&gt;
&lt;br&gt;
with regards,&lt;br&gt;
ramana</description>
    </item>
    <item>
      <pubDate>Fri, 28 Aug 2009 03:49:01 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#676427</link>
      <author>Ramana Murthy</author>
      <description>Hi James,&lt;br&gt;
&lt;br&gt;
One small doubt.&lt;br&gt;
Suppose I call interp1.m (matlab in-built function) in mex file.&lt;br&gt;
Will it's Execution time be less than what if it were to be called in a matlab script file?&lt;br&gt;
with same data, of course.&lt;br&gt;
&lt;br&gt;
I have one application (m file) where I am calling some 256x256x3 times the interp1.m function. If I send the data into mex routine and call interp1.m from mex file, compute and send the results back to m file, will it take less time? &lt;br&gt;
&lt;br&gt;
with regards,&lt;br&gt;
ramana</description>
    </item>
    <item>
      <pubDate>Fri, 28 Aug 2009 06:10:03 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#676442</link>
      <author>James Tursa</author>
      <description>&quot;Ramana murthy&quot; &amp;lt;omurthy@yahoo.com&amp;gt; wrote in message &amp;lt;h77k3d$bs4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi James,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; One small doubt.&lt;br&gt;
&amp;gt; Suppose I call interp1.m (matlab in-built function) in mex file.&lt;br&gt;
&amp;gt; Will it's Execution time be less than what if it were to be called in a matlab script file?&lt;br&gt;
&amp;gt; with same data, of course.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have one application (m file) where I am calling some 256x256x3 times the interp1.m function. If I send the data into mex routine and call interp1.m from mex file, compute and send the results back to m file, will it take less time? &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; with regards,&lt;br&gt;
&amp;gt; ramana&lt;br&gt;
&lt;br&gt;
No. Passing the variable to a mex file and then calling interp1 with mexCallMATLAB is going to take the same amount of time as calling it directly from a script file ... you are calling the exact same function in either case. In general, any m-file called from a mex routine with mexCallMATLAB is going to take at least as long as calling the same m-file from a script file. In some cases it can even take longer, because an m-file called from a script is allowed to return a shared data copy, whereas the same m-file called from a mex routine with mexCallMATLAB is prevented from returning a shared data copy ... so extra work may have to be done for the same call from a mex routine. I suspect MATLAB enforces this for mexCallMATLAB to make sure there is no unintended data corruption downstream in the mex routine.&lt;br&gt;
&lt;br&gt;
Situations where mex files shine is when there are a huge number of intermediate variables (matrix slices, etc.) that create a lot of overhead when coded in MATLAB, but all this overhead can potentially be saved by recoding the same algorithm in a mex routine. If the overhead is significant, the mex routine can significantly outperform the m-code.&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Fri, 28 Aug 2009 09:01:03 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#676468</link>
      <author>Ramana Murthy</author>
      <description>That was helpful James.&lt;br&gt;
Thank you very much,&lt;br&gt;
&lt;br&gt;
with regards,&lt;br&gt;
ramana</description>
    </item>
    <item>
      <pubDate>Wed, 23 Jun 2010 13:13:04 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#756865</link>
      <author>sakshi j</author>
      <description>Hi,&lt;br&gt;
I'm trying to run the following piece of code:&lt;br&gt;
void mexFunction(&lt;br&gt;
		 int          nlhs,&lt;br&gt;
		 mxArray      *[],&lt;br&gt;
		 int          nrhs,&lt;br&gt;
		 const mxArray *prhs[]&lt;br&gt;
		 )&lt;br&gt;
{&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;using namespace libbase;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;vector &amp;lt;double&amp;gt; y;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
double *xValues;&lt;br&gt;
&lt;br&gt;
int i,j;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
mxArray *value;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
xValues = mxGetPr(prhs[0]);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;int rowLen = mxGetN(prhs[0]);&lt;br&gt;
&amp;nbsp;int colLen = mxGetM(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
y.init(2);&lt;br&gt;
y=0;&lt;br&gt;
&lt;br&gt;
y(1)=3;&lt;br&gt;
y(2)=3;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
printf(&quot;the rowlength is=%d&quot;,rowLen);&lt;br&gt;
&lt;br&gt;
value = mxDuplicateArray(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
double neigh[] = {3,3};&lt;br&gt;
&amp;nbsp;&amp;nbsp;double *pr;&lt;br&gt;
mxArray *p;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
int nlhs1, nrhs1; &lt;br&gt;
mxArray *plhs1[2], *prhs1[2];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
nlhs1 = 2;  &lt;br&gt;
nrhs1 = 2; &lt;br&gt;
prhs1[0]=value; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
prhs1[1] = mxCreateCellMatrix(2, 1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;pr = mxGetPr(prhs1[1]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;for( i=0; i&amp;lt;=1; i++ ) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pr[i] = neigh[i];&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
mxSetCell(*p,1, );&lt;br&gt;
mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,&quot;wiener2&quot;);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
return;&lt;br&gt;
&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
i first run the following:&lt;br&gt;
a = im2double(imread('stego.tif'))'&lt;br&gt;
&lt;br&gt;
Then i compile my mex file.&lt;br&gt;
And I recieve the following output with this error:&lt;br&gt;
the rowlength is=256the value of neigh is=0.000000the value of neigh is=3.000000??? Error using ==&amp;gt; ones&lt;br&gt;
Size vector must be a row vector with real elements.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; wiener2 at 55&lt;br&gt;
localMean = filter2(ones(nhood), g) / prod(nhood);&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
Can anybody help me in this regard?</description>
    </item>
    <item>
      <pubDate>Wed, 23 Jun 2010 13:13:05 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#756866</link>
      <author>sakshi j</author>
      <description>Hi,&lt;br&gt;
I'm trying to run the following piece of code:&lt;br&gt;
void mexFunction(&lt;br&gt;
		 int          nlhs,&lt;br&gt;
		 mxArray      *[],&lt;br&gt;
		 int          nrhs,&lt;br&gt;
		 const mxArray *prhs[]&lt;br&gt;
		 )&lt;br&gt;
{&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;using namespace libbase;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;vector &amp;lt;double&amp;gt; y;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
double *xValues;&lt;br&gt;
&lt;br&gt;
int i,j;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
mxArray *value;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
xValues = mxGetPr(prhs[0]);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;int rowLen = mxGetN(prhs[0]);&lt;br&gt;
&amp;nbsp;int colLen = mxGetM(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
y.init(2);&lt;br&gt;
y=0;&lt;br&gt;
&lt;br&gt;
y(1)=3;&lt;br&gt;
y(2)=3;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
printf(&quot;the rowlength is=%d&quot;,rowLen);&lt;br&gt;
&lt;br&gt;
value = mxDuplicateArray(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
double neigh[] = {3,3};&lt;br&gt;
&amp;nbsp;&amp;nbsp;double *pr;&lt;br&gt;
mxArray *p;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
int nlhs1, nrhs1; &lt;br&gt;
mxArray *plhs1[2], *prhs1[2];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
nlhs1 = 2;  &lt;br&gt;
nrhs1 = 2; &lt;br&gt;
prhs1[0]=value; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
prhs1[1] = mxCreateCellMatrix(2, 1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;pr = mxGetPr(prhs1[1]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;for( i=0; i&amp;lt;=1; i++ ) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pr[i] = neigh[i];&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
mxSetCell(*p,1, );&lt;br&gt;
mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,&quot;wiener2&quot;);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
return;&lt;br&gt;
&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
i first run the following:&lt;br&gt;
a = im2double(imread('stego.tif'))'&lt;br&gt;
&lt;br&gt;
Then i compile my mex file.&lt;br&gt;
And I recieve the following output with this error:&lt;br&gt;
the rowlength is=256the value of neigh is=0.000000the value of neigh is=3.000000??? Error using ==&amp;gt; ones&lt;br&gt;
Size vector must be a row vector with real elements.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; wiener2 at 55&lt;br&gt;
localMean = filter2(ones(nhood), g) / prod(nhood);&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
Can anybody help me in this regard?</description>
    </item>
    <item>
      <pubDate>Wed, 23 Jun 2010 13:16:04 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#756870</link>
      <author>sakshi j</author>
      <description>&quot;James Tursa&quot; &amp;lt;aclassyguy_with_a_k_not_a_c@hotmail.com&amp;gt; wrote in message &amp;lt;h77sbr$p8s$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Ramana murthy&quot; &amp;lt;omurthy@yahoo.com&amp;gt; wrote in message &amp;lt;h77k3d$bs4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi James,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; One small doubt.&lt;br&gt;
&amp;gt; &amp;gt; Suppose I call interp1.m (matlab in-built function) in mex file.&lt;br&gt;
&amp;gt; &amp;gt; Will it's Execution time be less than what if it were to be called in a matlab script file?&lt;br&gt;
&amp;gt; &amp;gt; with same data, of course.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I have one application (m file) where I am calling some 256x256x3 times the interp1.m function. If I send the data into mex routine and call interp1.m from mex file, compute and send the results back to m file, will it take less time? &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; with regards,&lt;br&gt;
&amp;gt; &amp;gt; ramana&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; No. Passing the variable to a mex file and then calling interp1 with mexCallMATLAB is going to take the same amount of time as calling it directly from a script file ... you are calling the exact same function in either case. In general, any m-file called from a mex routine with mexCallMATLAB is going to take at least as long as calling the same m-file from a script file. In some cases it can even take longer, because an m-file called from a script is allowed to return a shared data copy, whereas the same m-file called from a mex routine with mexCallMATLAB is prevented from returning a shared data copy ... so extra work may have to be done for the same call from a mex routine. I suspect MATLAB enforces this for mexCallMATLAB to make sure there is no unintended data corruption downstream in the mex routine.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Situations where mex files shine is when there are a huge number of intermediate variables (matrix slices, etc.) that create a lot of overhead when coded in MATLAB, but all this overhead can potentially be saved by recoding the same algorithm in a mex routine. If the overhead is significant, the mex routine can significantly outperform the m-code.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; James Tursa&lt;br&gt;
&lt;br&gt;
Hi,&lt;br&gt;
I'm trying to run the following piece of code:&lt;br&gt;
void mexFunction(&lt;br&gt;
		 int          nlhs,&lt;br&gt;
		 mxArray      *[],&lt;br&gt;
		 int          nrhs,&lt;br&gt;
		 const mxArray *prhs[]&lt;br&gt;
		 )&lt;br&gt;
{&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;using namespace libbase;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;vector &amp;lt;double&amp;gt; y;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
double *xValues;&lt;br&gt;
&lt;br&gt;
int i,j;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
mxArray *value;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
xValues = mxGetPr(prhs[0]);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;int rowLen = mxGetN(prhs[0]);&lt;br&gt;
&amp;nbsp;int colLen = mxGetM(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
y.init(2);&lt;br&gt;
y=0;&lt;br&gt;
&lt;br&gt;
y(1)=3;&lt;br&gt;
y(2)=3;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
printf(&quot;the rowlength is=%d&quot;,rowLen);&lt;br&gt;
&lt;br&gt;
value = mxDuplicateArray(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
double neigh[] = {3,3};&lt;br&gt;
&amp;nbsp;&amp;nbsp;double *pr;&lt;br&gt;
mxArray *p;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
int nlhs1, nrhs1; &lt;br&gt;
mxArray *plhs1[2], *prhs1[2];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
nlhs1 = 2;  &lt;br&gt;
nrhs1 = 2; &lt;br&gt;
prhs1[0]=value; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
prhs1[1] = mxCreateCellMatrix(2, 1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;pr = mxGetPr(prhs1[1]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;for( i=0; i&amp;lt;=1; i++ ) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pr[i] = neigh[i];&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
mxSetCell(*p,1, );&lt;br&gt;
mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,&quot;wiener2&quot;);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
return;&lt;br&gt;
&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
i first run the following:&lt;br&gt;
a = im2double(imread('stego.tif'))'&lt;br&gt;
&lt;br&gt;
Then i compile my mex file.&lt;br&gt;
And I recieve the following output with this error:&lt;br&gt;
the rowlength is=256the value of neigh is=0.000000the value of neigh is=3.000000??? Error using ==&amp;gt; ones&lt;br&gt;
Size vector must be a row vector with real elements.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; wiener2 at 55&lt;br&gt;
localMean = filter2(ones(nhood), g) / prod(nhood);&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
Can anybody help me in this regard?</description>
    </item>
    <item>
      <pubDate>Wed, 23 Jun 2010 13:28:04 -0400</pubDate>
      <title>Re: mexCallMATLAB populating inputs</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258903#756879</link>
      <author>sakshi j</author>
      <description>&quot;sakshi j&quot; &amp;lt;sakshi399@yahoo.co.in&amp;gt; wrote in message &amp;lt;hvt191$o3f$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I'm trying to run the following piece of code:&lt;br&gt;
&amp;gt; void mexFunction(&lt;br&gt;
&amp;gt; 		 int          nlhs,&lt;br&gt;
&amp;gt; 		 mxArray      *[],&lt;br&gt;
&amp;gt; 		 int          nrhs,&lt;br&gt;
&amp;gt; 		 const mxArray *prhs[]&lt;br&gt;
&amp;gt; 		 )&lt;br&gt;
&amp;gt; {&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    &lt;br&gt;
&amp;gt;   using namespace libbase;&lt;br&gt;
&amp;gt;   &lt;br&gt;
&amp;gt;   &lt;br&gt;
&amp;gt;   vector &amp;lt;double&amp;gt; y;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   &lt;br&gt;
&amp;gt; double *xValues;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; int i,j;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; mxArray *value;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; xValues = mxGetPr(prhs[0]);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  int rowLen = mxGetN(prhs[0]);&lt;br&gt;
&amp;gt;  int colLen = mxGetM(prhs[0]);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; y.init(2);&lt;br&gt;
&amp;gt; y=0;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; y(1)=3;&lt;br&gt;
&amp;gt; y(2)=3;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; printf(&quot;the rowlength is=%d&quot;,rowLen);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; value = mxDuplicateArray(prhs[0]);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; double neigh[] = {3,3};&lt;br&gt;
&amp;gt;   double *pr;&lt;br&gt;
&amp;gt; mxArray *p;&lt;br&gt;
&amp;gt;   &lt;br&gt;
&amp;gt;   &lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; int nlhs1, nrhs1; &lt;br&gt;
&amp;gt; mxArray *plhs1[2], *prhs1[2];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; nlhs1 = 2;  &lt;br&gt;
&amp;gt; nrhs1 = 2; &lt;br&gt;
&amp;gt; prhs1[0]=value; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; prhs1[1] = mxCreateCellMatrix(2, 1);&lt;br&gt;
&amp;gt;   pr = mxGetPr(prhs1[1]);&lt;br&gt;
&amp;gt;   for( i=0; i&amp;lt;=1; i++ ) {&lt;br&gt;
&amp;gt;       pr[i] = neigh[i];&lt;br&gt;
&amp;gt;   }&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; mxSetCell(*p,1, );&lt;br&gt;
&amp;gt; mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,&quot;wiener2&quot;);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; return;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i first run the following:&lt;br&gt;
&amp;gt; a = im2double(imread('stego.tif'))'&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Then i compile my mex file.&lt;br&gt;
&amp;gt; And I recieve the following output with this error:&lt;br&gt;
&amp;gt; the rowlength is=256the value of neigh is=0.000000the value of neigh is=3.000000??? Error using ==&amp;gt; ones&lt;br&gt;
&amp;gt; Size vector must be a row vector with real elements.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; wiener2 at 55&lt;br&gt;
&amp;gt; localMean = filter2(ones(nhood), g) / prod(nhood);&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can anybody help me in this regard?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
SORRY...correction(this is the erraneous code):&lt;br&gt;
Hi,&lt;br&gt;
I'm trying to run the following piece of code:&lt;br&gt;
void mexFunction(&lt;br&gt;
		 int          nlhs,&lt;br&gt;
		 mxArray      *[],&lt;br&gt;
		 int          nrhs,&lt;br&gt;
		 const mxArray *prhs[]&lt;br&gt;
		 )&lt;br&gt;
{&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;using namespace libbase;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;vector &amp;lt;double&amp;gt; y;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
double *xValues;&lt;br&gt;
&lt;br&gt;
int i,j;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
mxArray *value;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
xValues = mxGetPr(prhs[0]);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;int rowLen = mxGetN(prhs[0]);&lt;br&gt;
&amp;nbsp;int colLen = mxGetM(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
y.init(2);&lt;br&gt;
y=0;&lt;br&gt;
&lt;br&gt;
y(1)=3;&lt;br&gt;
y(2)=3;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
printf(&quot;the rowlength is=%d&quot;,rowLen);&lt;br&gt;
&lt;br&gt;
value = mxDuplicateArray(prhs[0]);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
double neigh[] = {3,3};&lt;br&gt;
&amp;nbsp;&amp;nbsp;double *pr;&lt;br&gt;
mxArray *p;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
int nlhs1, nrhs1; &lt;br&gt;
mxArray *plhs1[2], *prhs1[2];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
nlhs1 = 2;  &lt;br&gt;
nrhs1 = 2; &lt;br&gt;
prhs1[0]=value; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
prhs1[1] = mxCreateDoubleMatrix(2, 1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;pr = mxGetPr(prhs1[1]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;for( i=0; i&amp;lt;=1; i++ ) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pr[i] = neigh[i];&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,&quot;wiener2&quot;);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
return;&lt;br&gt;
&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
i first run the following:&lt;br&gt;
a = im2double(imread('stego.tif'))'&lt;br&gt;
&lt;br&gt;
Then i compile my mex file.&lt;br&gt;
And I recieve the following output with this error:&lt;br&gt;
the rowlength is=256the value of neigh is=0.000000the value of neigh is=3.000000??? Error using ==&amp;gt; ones&lt;br&gt;
Size vector must be a row vector with real elements.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; wiener2 at 55&lt;br&gt;
localMean = filter2(ones(nhood), g) / prod(nhood);&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
Can anybody help me in this regard?</description>
    </item>
  </channel>
</rss>

