Friday, November 27, 2009

Print date and time: matlab

Wanted to learn what time the program was finished on the middle of the night or something like that...


having
 datestr(now)
at the end of the program helps to print out the date and time.

Wednesday, November 25, 2009

Matlab script for figure with background color

This is the Matlab script to make a white circle with dark background.

The figure1 creates a figure with dark background as indicated by the color attribute.
patch is a built in function which creates a light patch (which is a circle).

I tried the built in function "whitebg" which did not work except that it created another color background (viz: whitebg('green') gives me green background without solving the problem).
set(subplot(2,2,1),'Color','Red') actually sets the color for the subplot but I could not make it work for single figure.
Listed in Matlab file exchange:
http://www.mathworks.com/matlabcentral/fileexchange/25935
Here is the code:

The file gives a circle of given radius with dark background.
generate x and y vectors for circle.

figure1 = figure('Color',[0 0 0]);

axes1 = axes('Parent',figure1,'PlotBoxAspectRatio',...
[1 1 1],'Color',[0 0 0]);
% box('on');
patch(x,y,[1,1,1])
axis square


Note that the point here is not to generate shape, it can be done with conversion into polar co-ordinates (x,y) into (r,theta). My aim was to have different background for figure.

Thursday, November 12, 2009

Edit the Grub boot loader Menu.lst in Ubuntu

Everytime I upgrade the Ubuntu package, I come across the choice of keeping the boot loader. I try to keep the menu.lst updated by accepting the changes.
This has a consequence: The default value on the menu.lst makes computer boot into another version of Ubuntu.
For example if I had XP/Vista OS as Third Option (selection 2) then after changes it would just start whatever is on the third option.
It could be Ubuntu 9.10, kernel 2.6.x.x.-generic

So, I need some way to edit the menu.lst or the boot loader or the grub menu editor.

How do I do it?

start the terminal
type:
gksudo gedit /boot/grub/menu.lst
or
sudo vi /boot/grub/menu.lst
remove the un-necessary items on the list.
save it and restart.