Recently, I had to deal with a set of data, some from experiments, and some obtained using MATLAB “Curve Fitting Tool”. As much as I like MATLAB figures, I usually find Excel features more desirable for good-looking plots! So, I needed to extract the data of Curve Fitting Tool. Here is what I did:

Save the figure as a “.fig” file.

Make a m-file with the following code to get the x, y data of the curve!

Then you have access to the data, and you can get the arrays as

Then, your data is ready to copy/export to Excel.

Wordpress/Python integration

Why does it matter? Because we might need to write several posts with relatively similar content at the same time.

First of all, I need to install a Python library to interact with the WordPress blog. We can install it easily by the following code in command prompt. Open CMD.exe in your windows machine, and run:

This command will add python-wordpress-xmlrpc library to your installed Python. This library interacts using WordPress XML-RPC API. It is very easy to work with this library. I need to first import the required classes as:

Then I need to declare my WordPress blog login information:

Then, I can access to the posts by the following line:

Now, I want to write a new post and publish it in my WordPress blog:

In line 2, I can choose the title of the post. In line 3, I can choose the URL of the post. For example, I can choose “how-to-use-python-to-write-a-post-in-your-wordpress-website“. In line 4, I can write my post content. New lines, new tabs, and etc. can be used according to Python syntax. In line 6, you set the status of the post as “publish”ed!

and, the post is automatically uploaded in the WordPress blog.

More information on this Python library : python-wordpress-xmlrpc