Friday, May 30, 2008

MATLAB Warning: Initializing Handle Graphics failed in matlabrc.

Hello Folks!
I'm finally here again though my spare time is almost nonexistent, to post a solution about a "MATLABonLinux" issue.

Yesterday after the month-long reorganization of my disks and data on my Desktop PC with the reinstallation of ArchLinux as OS... and in the same time after the failure of my old Laptop with the migration to another old laptop of all data and the installation from scratch of ArchLinux also there...
I installed MATLAB R2007a on ArchLinux under a 2.6.25 kernel, with JRE 1.6.0_05-b13 and Xorg

After a clean installation and a clean setup with the install_matlab script you have to run after the graphic install... I opened the program to see this message as output of the initialization process as it was just before the prompt:

Warning: Initializing Handle Graphics failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
Attempted to access monitors(1,:); index out of bounds because size(monitors)=[0,4].

In matlabrc at 108

I began to search the Internet about this problem, but I found only references to a locale or pathdef problem I hadn't.

I tried to understand who called who in the initialization and going to matlabrc.m line 108 I found the call to another configuration/initialization script: hgrc.m
(All these configuration files are locate in your $MATLAB/toolbox/local/ directory where $MATLAB is your MATLAB installation path).

In hgrc.m I found the call to "get" to assign the matrix monitors who creates the issued that brought to the error.

In the MathWorks techincal documentation site you can find all the "Handle Graphics Object Properties" at this page
If you easily click on the root category of the properties in the list on the left you will find the very "MonitorPosition" property whose call led to an initialization error.

Actually the "get" call in hgrc.m assign to monitors the result of the MonitorPosition parameters that the MATLAB system recognized.

Probably due to a Java vs X incompatibility (I can't install FemLab because of a Java - X version to version issue) the get function returns and empty matrix for the call about MonitorDefinition

The solution is quite brutal. I read what data should output the get(0,'MonitorPosition') call, and I assigned them directly to the monitor variable modifying the hgrc.m script.

As you can find in the previous linked documentation page:

[x y width height;x y width height] Width and height of primary and secondary monitors, in pixels. This property contains the width and height of each monitor connnected to your computer. The x and y values for the primary monitor are 0, 0 and the width and height of the monitor are specified in pixels. The secondary monitor position is specified as
x = primary monitor width + 1
y = primary monitor height + 1
Querying the value of the figure MonitorPosition on a multiheaded system returns the position for each monitor on a separate line.
v = get(0,'MonitorPosition')
v =
x y width height % Primary monitor
x y width height % Secondary monitor
Note that MATLAB sets the value of the ScreenSize property to the combined size of the monitors

The monitors array for a 1024x768 monitor as mine should be:
monitors = [0,0,1024,768;1025,769,1024,768];

and for a 1280x1024 monitor as my desktop:
monitors = [0,0,1280,1024;1281,1025,1280,1024];

So in the end I commented this line in hgrc.m:
monitors = get(0, 'MonitorPosition');

inserting a '%' character before the line... and I added the manual assign of the correct matrix to the monitors variable:
monitors = [0,0,1024,768;1025,769,1024,768];

After this workaround my MATLAB starts without any problem and displays every figure correctly.

That's all folks.. I hope this solution is useful for someone...

Keep On Hacking!

Monday, May 5, 2008

Finally Bike!

On Sunday April 7th, I went with some ciclyst to San Fermo della Battaglia, near Como toward Chiasso, it was awesome, and I could understand the actual possible range of my rides, and it's very good. This is the route I created with GoogleMaps ;-)

View Larger Map

To complete the pysical destruction of these days, on May 1st, after the Mass, for my grandparents 55th marry anniversary ;-) I talked with Father Federico of S. Victor Parish about road bicycle. The same afternoon I went with him to Castiglione Olona to the awesome slope of Piccolo Stelvio! Argh!
I withstood to the next 70km in 5 days, though I got some cramps on the way back.
It's been very funny to managed my legs everytime I had to push the pedal, to avoid the cramps to come out and block my legs, the whole thing while going steadly at about 30km per hour!
To be fitter that now is obviously my aim for the next months, but I'm very happy for my "base-resistance".

Here it is the map to Castiglione Olona

View Larger Map

Bene dai, lascio le amenità ciclistico internautiche per tornare allo studio, quest'anno posso organizzarmi decentemente... quindi sarebbe un'idea farlo veramente :-D

Buona giornata a tutti!



Well! Hello Folks!
After some political post one the Italian side of this blog, though them hasn't been too much useful (even if the Democrats defeat, luckily was not a complete tragedy)... I have been away for a while from my digital-life. It was such as a disintossication, becuase in the last months I had to update daily Rho's Democrats website, post about politics in this space, and finally I opened the Ammazzacaffè website, you can find right here at this "serious" domain

In 25th April's night, I went with some friend in Tradate to attend a speaking of Father Alex Zanottelli and Father Luigi Ciotti.
These two increbible priests, literally woke up our minds and re-created in us the will to commit ourselves about the human rights, equality, and the thing and the values in which we trust. They told us of our time's great problems, of the Mafia's and dangerous lobbies' strategies, of the distorted worship of the profit that can bring not to consider valuable neither human life, while taking in great account only money.
Against all this things, for a better world we have to, and we can work for justice with our daily choices. Evrey day we can put a crumb in favor of our ideals, simply with our behaviour, saying a word despite closing in an accompliceful silence, with our little choices our lifestyle, and with the quality of the our relations between each other.
That was really a wonderful meeting, rich in ideas, in warning about the actual problems of our world.
It was also a moment of amazing vitality, great hope in man's ability to get himself out of the mess he has made. It was definitely, also a great faith testimony, a faith intended in an active meaning, such as a faith in a God who suffer himself because of this situations of poorness, injustice and inequalità, but a God who aids the poors of this world too, through many people, helping them to get themselves little and poor to be carrier of consolation, help, support, and able to speak out against these things, to get finally, justice and peace.

With Giovani idee (Young Ideas) we are going on with the petition to ask improved bicycle roads, to rember to our Major that in Rho, our city, the people who uses bicycle is an important number :-)
We got almost 1000 signatures from the citizens.
It was actually at one of this petion stands, I spoke with a neighbour about bicycle, and he invited me to go by him and his friend the next sunday with the roadbike.
So in the next post I will publish the routes finally I've made :-)