<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Sun, May 26, 2013 at 4:30 AM, Sudheer Joseph <span dir="ltr"><<a href="mailto:sudheer.joseph@yahoo.com" target="_blank">sudheer.joseph@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Dear Brian,<br>
                I even tried below but no luck!<br>
In [138]: xx=np.zeros(11)<br>
In [139]: xx<br>
Out[139]: array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])<br>
<br>
In [147]: xx.shape<br>
Out[147]: (11,)<br>
In [140]: xx=np.array(xx)[np.newaxis]<br>
In [141]: xx.shape<br>
Out[141]: (1, 11)<br>
In [142]: xx=xx.T<br>
In [143]: xx.shape<br>
Out[143]: (11, 1)<br>
In [144]: csum.shape<br>
Out[144]: (11, 5)<br>
In [145]: np.vstack((xx,csum))<br>
<div class="im">---------------------------------------------------------------------------<br>
ValueError                                Traceback (most recent call last)<br>
</div>/media/SJOITB/SST_VAL/<ipython-input-145-2a0a60f68737> in <module>()<br>
----> 1 np.vstack((xx,csum))<br>
<div class="im"><br>
/usr/local/lib/python2.7/dist-packages/numpy-1.7.0-py2.7-linux-x86_64.egg/numpy/core/shape_base.pyc in vstack(tup)<br>
    224 <br>
    225     """<br>
--> 226     return _nx.concatenate(map(atleast_2d,tup),0)<br>
    227 <br>
    228 def hstack(tup):<br>
<br>
ValueError: all the input array dimensions except for the concatenation axis must match exactly<br>
<br>  <br></div></blockquote><div><br></div><div style>You've transposed the arrays, so now you need to stack the other way. So, you need to use hstack to concatenate arrays with the same column length (first axis), or vstack to concatenate arrays with the same row length (second axis). For example:</div>
<div style><br></div><div style><div>In [110]: xx1 = np.zeros((1,7)); cc1 = np.ones((3,7))</div><div><br></div><div>In [111]: xx2 = np.zeros((7,1)); cc2 = np.ones((7,3))</div><div><br></div><div>In [112]: np.vstack((xx1, cc1))</div>
<div>Out[112]: </div><div>array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],</div><div>       [ 1.,  1.,  1.,  1.,  1.,  1.,  1.],</div><div>       [ 1.,  1.,  1.,  1.,  1.,  1.,  1.],</div><div>       [ 1.,  1.,  1.,  1.,  1.,  1.,  1.]])</div>
<div><br></div><div>In [113]: np.hstack((xx2, cc2))</div><div>Out[113]: </div><div>array([[ 0.,  1.,  1.,  1.],</div><div>       [ 0.,  1.,  1.,  1.],</div><div>       [ 0.,  1.,  1.,  1.],</div><div>       [ 0.,  1.,  1.,  1.],</div>
<div>       [ 0.,  1.,  1.,  1.],</div><div>       [ 0.,  1.,  1.,  1.],</div><div>       [ 0.,  1.,  1.,  1.]])</div><div><br></div></div><div style><br></div><div style>Also, I would highly recommend studying the NumPy for MATLAB users guide:</div>
<div style><br></div><div style><a href="http://www.scipy.org/NumPy_for_Matlab_Users">http://www.scipy.org/NumPy_for_Matlab_Users</a><br></div><div style><br></div><div style>These issues (any many more) are discussed there.</div>
<div style><br></div><div style><br></div><div style>Cheers,</div><div style>Aronne</div></div></div></div>