Monday, June 30, 2008

Full Screen Figures in Matlab

Matlab's native figure command does not give you an option to make your figure full screen in 1 step. Instead first you have to find the screen resolution and then give your figure command the size of the screen.

First thing you want to do is:

screen_size = get(0, 'ScreenSize');

This will return a 4 element array: (left, bottom, width, height);
The ones we are interested are the "width" and "height".

Now we have the size of the screen, we can make our figure full screen:

f1 = figure(1);
set(f1, 'Position', [0 0 screen_size(3) screen_size(4) ] );

Now you should have a figure that is full screen.

Saturday, June 14, 2008

Changing the SMTP port number in Evolution

I started using evolution email client in Ubuntu. However, my service provider requires me to use a different port for SMTP. When you first check the tab where you set the options for SMTP, you can not find a field about the port number of SMTP. I was looking for a field because Thunderbird has a field for port.
The solution is this :

smtp.hostname.com --> Assumes you are using port 25.

smtp.hostname.com:587 --> You set the SMTP port to 587.

I think this is not a good way to handle ports, but I am happy since I found a soluton.

Wednesday, June 04, 2008

A simple problem with LLNL's VisIt

Recently I found the LLNL's visualization software called VisIt. It has many capabilities and the graphics looked promising from their screenshots. So I wanted to give it a try. However, I had a problem and found the solution with a trial and error way. Since VisIt is developed to be working on distributed systems and parallel systems, it is always using sockets to connect to its server part even you are using them on the same computer.

So when you call the main program with gui,

>visit.exe

It will generate the following commands

Running: "C:\Program Files\LLNL\VisIt 1.9.0\gui"
Running: "C:\Program Files\LLNL\VisIt 1.9.0\viewer" -geometry 1272x1020+408+0 -borders 22,4,4,4 -shift 4,22 -p
reshift 4,22 -defer -host your.hostname -port 5600
Running: "C:\Program Files\LLNL\VisIt 1.9.0\mdserver" -host your.hostname -port 5602

So if you are running it the first time, Windows will ask you to open the ports given above to be unblocked. I unblocked them.

Then suddenly at 32%, mdserver crashed.

After several forum messages and trials, I was still getting the same error.

Later, I installed VisIt to my home computer also and it worked without a problem. Therefore, I started looking for the differences between my two computers. The first and the most obvious difference was with the network connections. At my home computer I had VMWare installed. When you install VMWare, it creates several different network connections, which were enabled by default. Even though they are not real connections, VisIt still handled them according to their IP adresses.

Finally, I disabled all my network connections created by VMWare. Give one more try to VisIt and it started working.

I think the fix will be considered with the next release of VisIt.

Export figures in Matlab without displaying them

Assuming you have a lot of figures to plot, but you do not want to wait and see them in Matlab's figure window. There is a way you can export all of your figures without displaying them. This might also save you some time, since you are drawing them on the screen.

Here is how :

% Create a figure with visibility off
f = figure('Visible','off');
% Then do your plot
plot
% Finally export the plot as an image
print('-dpng', 'test.png');

You can also make this in a loop (Which is very probable if you have too many figures).
Do this

for i:1, n
f = figure('Visible','off');
plot
filename = sprintf('plot-%d',i);
print('-dpng', filename);
end

This will give you 'n' png images with your plots in it.