/*---------------------------------------------------------------------------*\ FILE........: octave.c AUTHOR......: David Rowe DATE CREATED: April 28 2012 Functions to save C arrays in GNU Octave matrix format. The output text file can be directly read into Octave using "load filename". \*---------------------------------------------------------------------------*/ /* Copyright (C) 2012 David Rowe All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ #include #include "octave.h" void octave_save_int(FILE *f, char name[], int data[], int rows, int cols) { int r,c; fprintf(f, "# name: %s\n", name); fprintf(f, "# type: matrix\n"); fprintf(f, "# rows: %d\n", rows); fprintf(f, "# columns: %d\n", cols); for(r=0; r