comparison toolboxes/FullBNT-1.0.7/bnt/learning/mk_tetrad_data_file.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function mk_tetrad_data_file(filename, samples, sig)
2 % MK_TETRAD_DATA_FILE Make a file containing raw discrete data for input to TETRAD
3 % mk_tetrad_data_file(filename, samples, sig)
4 %
5 % samples(i,j) is the value for case i, variable j
6 % The resulting file can be used for the 'build' part of Tetrad.
7 % For details on tetrad, see hss.cmu.edu/html/departments/philosophy/TETRAD/tetrad.html
8
9 [nsamples N] = size(samples);
10
11 fid = fopen(filename, 'w');
12 fprintf(fid, '/Raw\n');
13 fprintf(fid, '%d\n', nsamples);
14 for i=1:N
15 fprintf(fid, 'x%d ', i);
16 end
17 fprintf(fid, '\n');
18 for i=1:nsamples
19 fprintf(fid, '%d ', samples(i,:)-1); % tetrad counts from 0
20 fprintf(fid, '\n');
21 end
22 %fprintf(fid, '/Knowledge\n');
23 %fprintf(fid, 'Significance %4.2f\n', sig);
24 fclose(fid);
25