The Experimentor

Experimenting ON Earth

MATLAB report generator, simple way, smart output

In a previous post I had shown how to use MATLAB and the web command to use the power of HTML in MATLAB to display program outputs in a more fabulous manner.
But sometimes the complexity of the procedure doesn’t worth the effort it takes.

In cases where direct manipulation of HTML is not required there is a much simpler but
smarter way. The code is here. The code snippet responsible for generating the report
is highlighted.

Download source

March 1, 2008 Posted by asadujjaman | ACADEMIC, MATLAB | | No Comments Yet

Palindromes

Numbers such as 233332 are called palindromes. They have the property that they are same forward as backward. Interestingly enough if we start from any number and continuously reverse and add, it usually ends up in a palindrome.

For example we start with 7513:

7513+3157= 10670

10670+7601=18271

18271+17281=35552

35552+25553=61105

61105+50116=111221

111221+122111=233332

Thus we get a palindrome in six reverse and add operations.

Here is a simple python program to do the dirty reverse and add and give us the palindromes.

Notably, not every integer yields a palindrome this way. For example 196 does not.


Download the source

March 1, 2008 Posted by asadujjaman | Python | | No Comments Yet