2014年6月1日星期日

Changing Fonts in Matlab Plots

Ref: http://stackoverflow.com/questions/8934468/changing-fonts-in-matlab-plots/8957573#8957573

more setting see HINT/mfiles/hist_custom.m
It's possible to change default fonts, both for the axes and for other text, by adding the following lines to the startup.m file.
% Change default axes fonts.
set(0,'DefaultAxesFontName', 'Times New Roman')
set(0,'DefaultAxesFontSize', 14)

% Change default text fonts.
set(0,'DefaultTextFontname', 'Times New Roman')
set(0,'DefaultTextFontSize', 14)
If you don't know if you have a startup.m file, run
which startup
to find its location. If Matlab says there isn't one, run
userpath
to know where it should be placed.


2014年5月24日星期六

export data to file

1, csvwrite / dlmwrite
csvwrite('data.csv', refgeom); % to a csv file
dlmwrite('my_data.out',A, ';')  % with seperator = ';'

2, fwrite
fid = fopen('data.bin', 'w');
fwrite(fid, refgeom);
fclose(fid);

random number test

1, if the File system is NTFS, /assess maybe not executable. So copy all the file to ubuntu File system.
make it.

2, segment error.
下载解压包SP800-20 sts-2.1 ,重新安装。

3, how to use
./assess 100000


2014年5月22日星期四

Histograms of two sets of data with different color in matlab

Ref: http://chi3x10.wordpress.com/2008/03/10/histograms-of-two-set-of-data-with-different-color-in-matlab/
1
2
3
4
5
6
7
8
9
10
11
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.:
1
2
3
4
5
6
7
8
9
10
11
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’);