Pages

Friday 21 November 2014

Saving Numpy arrays to Matlab compatible files

Working in Python but want to use you data in Matlab too.

A simple function call can do this. Here is the code:

import scipy.io as spio
spio.savemat('saveSymmetricPose.mat', 
             dict(matlabVarName = pythonVarName, matlabVarName1 = pythonVarName1))

Here savemat from scipy.io stores a number of arrays to a Mat file, that can be easily opened in Matlab. Hope this could help someone.

Source: converting-numpy-arrays-to-matlab-and-vice-versa

Thursday 20 November 2014

Hello to SyntaxHighlighter

I am trying to check if I can make SyntaxHighlighter work on my blog. This would really help me in a number of future blogposts.

#include <iostream>

int main()
{
     std::cout << "Hello SyntaxHighlighter" << std::endl;
     return 0;
}
I use html encode from here to encode the < > characters as they conflict with the HTML Tag Syntax . The code is copied directly into HTML code for this post using the <pre> Tag as:
 
<pre class="brush:cpp">
#include <iostream>

int main()
{
std::cout << "Hello SyntaxHighlighter" << std::endl;

return 0;
}
</pre>


This is very useful and I think I will try to update all my codes in previous posts with this.
Source: http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html