view examples/mycell.c @ 18663:271873b2f44f

importdata.m: Return cellstr of text when no numeric data found (bug #41630). * importdata.m: If no numeric data found, read in entire file as chars. Use strsplit with EOL as delimiter to return cellstr of lines.
author Philip Nienhuis <prnienhuis@users.sf.net>
date Wed, 02 Apr 2014 20:46:57 +0200
parents 224e76250443
children
line wrap: on
line source

#include "mex.h"

void
mexFunction (int nlhs, mxArray* plhs[],
             int nrhs, const mxArray* prhs[])
{
  mwSize n;
  mwIndex i;

  if (nrhs != 1 || ! mxIsCell (prhs[0]))
    mexErrMsgTxt ("ARG1 must be a cell");

  n = mxGetNumberOfElements (prhs[0]);
  n = (n > nlhs ? nlhs : n);

  for (i = 0; i < n; i++)
    plhs[i] = mxDuplicateArray (mxGetCell (prhs[0], i));
}