function convertToBioBayes(T,D,Names,filename) %convertToBioBayes Converts Matlab data into BioBayes dataset description % convertToBioBayes(T,D,Names,Filename), where % T is a row vector of time values at which the data has been % measured % D is a matrix in which rows correspond to measured variables % The number of columns in vector T and matrix D must be equal. % Names is a set of cells which define the names of the variables. % The number of elements in this set must be equal to the number % of rows in D. % filename is a string name of the file to which BioBayes description % of the dataset will be written. % % EXAMPLE: % T = [1,2,3,4]; % D = [1 2 3 4; % 5 6 7 8]; % Names = {'m1','m2'}; % convertToBioBayes(T,D,Names,'test.data'); % % See also LOAD. % Copyright 2007-2008 University of Glasgow if (size(T,2) ~= size(D,2)) fprintf('The size of the time course and the data set do not agree'); end fout = fopen(filename,'w'); fprintf(fout,'\n\n \n',size(D,1)+1); for row=1:size(T,2) fprintf(fout,'\n'); fprintf(fout,'\n',T(row)); for col=1:size(D,1) fprintf(fout,'\n',D(col,row),col); end fprintf(fout,''); end fprintf(fout,''); fprintf(fout,' \n \n \n\n'); fclose(fout); end