tomwalters@0: /* tomwalters@0: Copyright (c) Applied Psychology Unit, Medical Research Council. 1993 tomwalters@0: =========================================================================== tomwalters@0: tomwalters@0: Permission to use, copy, modify, and distribute this software without fee tomwalters@0: is hereby granted for research purposes, provided that this copyright tomwalters@0: notice appears in all copies and in all supporting documentation, and that tomwalters@0: the software is not redistributed for any fee (except for a nominal tomwalters@0: shipping charge). Anyone wanting to incorporate all or part of this tomwalters@0: software in a commercial product must obtain a license from the Medical tomwalters@0: Research Council. tomwalters@0: tomwalters@0: The MRC makes no representations about the suitability of this tomwalters@0: software for any purpose. It is provided "as is" without express or tomwalters@0: implied warranty. tomwalters@0: tomwalters@0: THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING tomwalters@0: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL tomwalters@0: THE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES tomwalters@0: OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, tomwalters@0: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, tomwalters@0: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS tomwalters@0: SOFTWARE. tomwalters@0: */ tomwalters@0: tomwalters@0: /*-------------------------------------------------------------------------*/ tomwalters@0: tomwalters@0: /* matrix.c tomwalters@0: * ---------- tomwalters@0: * tomwalters@0: * Writes an interal histogram matrix in two pretty (ascii) formats. tomwalters@0: * tomwalters@0: * M. Akeroyd. Summer 1993. Revised Winter 1994. tomwalters@0: */ tomwalters@0: tomwalters@0: tomwalters@0: #include tomwalters@0: #include tomwalters@0: #include tomwalters@0: #include "tip.h" tomwalters@0: tomwalters@0: extern char progname[MAX_STRING_LENGTH]; tomwalters@0: extern int verboseflag; tomwalters@0: extern short interval[MAX_CHANNELS][MAX_DATA]; tomwalters@0: extern short summation[MAX_CHANNELS]; tomwalters@0: extern int summationflag; tomwalters@0: tomwalters@0: extern int frameheight; tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: /*-------------------------------------------------------------------------*/ tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: void write_matrix_hori_freq(int framewidth, FILE *outputfigurefp) tomwalters@0: { tomwalters@0: /* Format of matrix: tomwalters@0: * tomwalters@0: # (Info on file, inclduing name, pwdith, nwidth, mincf etc goes here) tomwalters@0: # Rows = channels. Columns = intervals (samples) tomwalters@0: # tomwalters@0: # Time Interval (samples) tomwalters@0: # 0 1 2 3 4 5 6 7 8 9 ..... (framewidth-1) tomwalters@0: # ....................................................................... tomwalters@0: c frameheight tomwalters@0: h ... tomwalters@0: a ... tomwalters@0: n ... tomwalters@0: n 4 tomwalters@0: e 3 tomwalters@0: l 2 tomwalters@0: s 1 tomwalters@0: tomwalters@0: # ...................................................................... tomwalters@0: tomwalters@0: * ALL comment lines have '#' in them. tomwalters@0: * tomwalters@0: * The entries are raw numbers: at the moment, no normalisation has taken tomwalters@0: * place. So the longer the .sai, the bigger the numbers. tomwalters@0: * tomwalters@0: * If the '-s' flag is set, then the row (=channel) sums are printed at tomwalters@0: * the end of each ROW. tomwalters@0: * tomwalters@0: * This version prints "." instead of zeros. tomwalters@0: */ tomwalters@0: tomwalters@0: tomwalters@0: int channel, sample; tomwalters@0: tomwalters@0: /* rest of header ... */ tomwalters@0: fprintf(outputfigurefp,"# Rows = channels Columns = intervals (samples)\n"); tomwalters@0: fprintf(outputfigurefp, "# \n"); tomwalters@0: tomwalters@0: /* Top line */ tomwalters@0: fprintf(outputfigurefp, "# "); tomwalters@0: for (sample=0; sample=1; channel --) { tomwalters@0: fprintf(outputfigurefp, " %2i: ", channel); tomwalters@0: for (sample = 0; sample < framewidth; sample++){ tomwalters@0: if (interval[channel][sample] == 0) tomwalters@0: fprintf(outputfigurefp, " . "); tomwalters@0: else tomwalters@0: fprintf(outputfigurefp, "%5i ", interval[channel][sample]); tomwalters@0: } tomwalters@0: tomwalters@0: if (summationflag == ON) tomwalters@0: fprintf(outputfigurefp, " : %5i", summation[channel]); tomwalters@0: tomwalters@0: fprintf(outputfigurefp, "\n"); tomwalters@0: } tomwalters@0: tomwalters@0: /* bottom tabulation line */ tomwalters@0: fprintf(outputfigurefp, "# "); tomwalters@0: for (sample=0; sample