Read LiDar/LAS file in matlab.

January 11, 2010

Below is the c code for reading LiDar/LAS file into matlab. To compile the code, simply use
mex LASReader.cpp

The code reads the points coordinates only. Please see the code for details.

For details of LiDar file format, please visit this link.

Read the rest of this entry »

Advertisements

Histograms of two sets of data with different color in matlab

March 10, 2008
figure;
hist(data1);
hold on;
%//make data1 red
%//get the handle of the bars in a histogram
h = findobj(gca,'Type','patch');
%//color of the bar is red and the color of the border
%// of the bar is white!
set(h,'FaceColor','r','EdgeColor','w');
%//data 2 use default color!
hist(data2);

Edit: 03/30/09

As suggested by Adam in the comments, there is a better way to achieve that. Thanks Adam!!
_______________________________

The variable h contains handles to each of the histograms. Just use “set” on each element individually.

e.g.:

hist(data1);
 hold on;
 hist(data2);
 hist(data3);

h = findobj(gca,’Type’,’patch’);
display(h)

set(h(1),’FaceColor’,’r’,’EdgeColor’,’k’);
set(h(2),’FaceColor’,’g’,’EdgeColor’,’k’);
set(h(2),’FaceColor’,’b’,’EdgeColor’,’k’);