<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/262000</link>
    <title>MATLAB Central Newsreader - mxCreateDoubleMatrix() function</title>
    <description>Feed for thread: mxCreateDoubleMatrix() function</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, 30 Sep 2009 16:11:00 -0400</pubDate>
      <title>mxCreateDoubleMatrix() function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/262000#683747</link>
      <author>Geoffroy </author>
      <description>I have created a small interface to transfert data between a C++ program and a Matlab workspace. It is working well but I don't know how to create a 3 dimensional matrix to contain a RGB image. I'am able to create and transfert 2D matrix but not a 3D matrix like Im = zeros ( 10, 10, 10 );&lt;br&gt;
&lt;br&gt;
How is it possible to do that?&lt;br&gt;
&lt;br&gt;
Thank you   </description>
    </item>
    <item>
      <pubDate>Wed, 30 Sep 2009 18:16:35 -0400</pubDate>
      <title>Re: mxCreateDoubleMatrix() function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/262000#683765</link>
      <author>Titus Edelhofer</author>
      <description>&lt;br&gt;
&quot;Geoffroy &quot; &amp;lt;grsabourin@gmail.com&amp;gt; schrieb im Newsbeitrag &lt;br&gt;
news:h9vvuk$qip$1@fred.mathworks.com...&lt;br&gt;
&amp;gt;I have created a small interface to transfert data between a C++ program &lt;br&gt;
&amp;gt;and a Matlab workspace. It is working well but I don't know how to create a &lt;br&gt;
&amp;gt;3 dimensional matrix to contain a RGB image. I'am able to create and &lt;br&gt;
&amp;gt;transfert 2D matrix but not a 3D matrix like Im = zeros ( 10, 10, 10 );&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; How is it possible to do that?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thank you&lt;br&gt;
&lt;br&gt;
Hi,&lt;br&gt;
you will need to use mxCreateNumericArray. The doc gives a three dimensional &lt;br&gt;
example.&lt;br&gt;
&lt;br&gt;
Titus </description>
    </item>
    <item>
      <pubDate>Thu, 01 Oct 2009 00:33:05 -0400</pubDate>
      <title>Re: mxCreateDoubleMatrix() function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/262000#683822</link>
      <author>Geoffroy </author>
      <description>Yes I have finally found this function but I don't have any result. If I call the function like that&lt;br&gt;
&lt;br&gt;
const mwSize dims[]={3,3};&lt;br&gt;
const mwSize NbDimension = 2;&lt;br&gt;
MatlabArray = mxCreateNumericArray( NbDimension, dims, mxUINT16_CLASS, mxREAL );&lt;br&gt;
&lt;br&gt;
I put the variable like that&lt;br&gt;
engPutVariable( m_pEngine, in_VarName.c_str(), MatlabArray ) ;&lt;br&gt;
&lt;br&gt;
I obtain a 3x3 matrix in the matlab workspace ( only one dimension)&lt;br&gt;
&lt;br&gt;
If I try to increase the dimension the function return 0&lt;br&gt;
	const mwSize dims[]={3,3};&lt;br&gt;
	const mwSize NbDimension = 4;&lt;br&gt;
	MatlabArray = mxCreateNumericArray( NbDimension, dims, mxUINT16_CLASS, mxREAL );&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Titus Edelhofer&quot; &amp;lt;titus.edelhofer@mathworks.de&amp;gt; wrote in message &amp;lt;ha07a3$bg6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Geoffroy &quot; &amp;lt;grsabourin@gmail.com&amp;gt; schrieb im Newsbeitrag &lt;br&gt;
&amp;gt; news:h9vvuk$qip$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &amp;gt;I have created a small interface to transfert data between a C++ program &lt;br&gt;
&amp;gt; &amp;gt;and a Matlab workspace. It is working well but I don't know how to create a &lt;br&gt;
&amp;gt; &amp;gt;3 dimensional matrix to contain a RGB image. I'am able to create and &lt;br&gt;
&amp;gt; &amp;gt;transfert 2D matrix but not a 3D matrix like Im = zeros ( 10, 10, 10 );&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How is it possible to do that?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thank you&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; you will need to use mxCreateNumericArray. The doc gives a three dimensional &lt;br&gt;
&amp;gt; example.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Titus &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Thu, 01 Oct 2009 03:19:01 -0400</pubDate>
      <title>Re: mxCreateDoubleMatrix() function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/262000#683840</link>
      <author>Geoffroy </author>
      <description>Yes I have finally found this function but I don't have any result. If I call the function like that&lt;br&gt;
&lt;br&gt;
const mwSize dims[]={3,3};&lt;br&gt;
const mwSize NbDimension = 2;&lt;br&gt;
MatlabArray = mxCreateNumericArray( NbDimension, dims, mxUINT16_CLASS, mxREAL );&lt;br&gt;
&lt;br&gt;
I put the variable like that&lt;br&gt;
engPutVariable( m_pEngine, in_VarName.c_str(), MatlabArray ) ;&lt;br&gt;
&lt;br&gt;
I obtain a 3x3 matrix in the matlab workspace ( only one dimension)&lt;br&gt;
&lt;br&gt;
If I try to increase the dimension the function return 0&lt;br&gt;
	const mwSize dims[]={3,3};&lt;br&gt;
	const mwSize NbDimension = 4;&lt;br&gt;
	MatlabArray = mxCreateNumericArray( NbDimension, dims, mxUINT16_CLASS, mxREAL );&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Titus Edelhofer&quot; &amp;lt;titus.edelhofer@mathworks.de&amp;gt; wrote in message &amp;lt;ha07a3$bg6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Geoffroy &quot; &amp;lt;grsabourin@gmail.com&amp;gt; schrieb im Newsbeitrag &lt;br&gt;
&amp;gt; news:h9vvuk$qip$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &amp;gt;I have created a small interface to transfert data between a C++ program &lt;br&gt;
&amp;gt; &amp;gt;and a Matlab workspace. It is working well but I don't know how to create a &lt;br&gt;
&amp;gt; &amp;gt;3 dimensional matrix to contain a RGB image. I'am able to create and &lt;br&gt;
&amp;gt; &amp;gt;transfert 2D matrix but not a 3D matrix like Im = zeros ( 10, 10, 10 );&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How is it possible to do that?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thank you&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; you will need to use mxCreateNumericArray. The doc gives a three dimensional &lt;br&gt;
&amp;gt; example.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Titus &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Thu, 01 Oct 2009 05:08:01 -0400</pubDate>
      <title>Re: mxCreateDoubleMatrix() function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/262000#683854</link>
      <author>James Tursa</author>
      <description>&quot;Geoffroy &quot; &amp;lt;grsabourin@gmail.com&amp;gt; wrote in message &amp;lt;ha1735$j6n$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Yes I have finally found this function but I don't have any result. If I call the function like that&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; const mwSize dims[]={3,3};&lt;br&gt;
&amp;gt; const mwSize NbDimension = 2;&lt;br&gt;
&amp;gt; MatlabArray = mxCreateNumericArray( NbDimension, dims, mxUINT16_CLASS, mxREAL );&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I put the variable like that&lt;br&gt;
&amp;gt; engPutVariable( m_pEngine, in_VarName.c_str(), MatlabArray ) ;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I obtain a 3x3 matrix in the matlab workspace ( only one dimension)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If I try to increase the dimension the function return 0&lt;br&gt;
&amp;gt; 	const mwSize dims[]={3,3};&lt;br&gt;
&amp;gt; 	const mwSize NbDimension = 4;&lt;br&gt;
&amp;gt; 	MatlabArray = mxCreateNumericArray( NbDimension, dims, mxUINT16_CLASS, mxREAL );&lt;br&gt;
&lt;br&gt;
That's because you are reading beyond the end of valid memory. dims still just has 2 elements the way you have written it, not 4. You need to give dims 4 elements, e.g. dims[] = {3,3,3,3}.&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Thu, 01 Oct 2009 05:08:02 -0400</pubDate>
      <title>Re: mxCreateDoubleMatrix() function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/262000#683855</link>
      <author>Ryan Ollos</author>
      <description>&quot;Geoffroy &quot; &amp;lt;grsabourin@gmail.com&amp;gt; wrote in message &amp;lt;ha0tc1$nv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Yes I have finally found this function but I don't have any result. If I call the function like that&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; const mwSize dims[]={3,3};&lt;br&gt;
&amp;gt; const mwSize NbDimension = 2;&lt;br&gt;
&amp;gt; MatlabArray = mxCreateNumericArray( NbDimension, dims, mxUINT16_CLASS, mxREAL );&lt;br&gt;
&lt;br&gt;
mwSize ndim = 3&lt;br&gt;
mwSize  dims = {10, 10, 10}&lt;br&gt;
&lt;br&gt;
That should give you the 10 x 10 x 10 array you referred to in your first example. </description>
    </item>
  </channel>
</rss>

