~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to examples/mex-examples/mex-with-objects/mexfunction12.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include "mex.h"
3
 
 
4
 
/*
5
 
 * Test function : Storing a Matrix in Scilab workspace 
6
 
 * mexPutFull uses cwritemat 
7
 
 */
8
 
 
9
 
void mexfunction12(nlhs, plhs, nrhs, prhs)
10
 
     int nlhs, nrhs;
11
 
     Matrix *plhs[]; Matrix *prhs[];
12
 
{  
13
 
  mxArray *array_ptr;
14
 
  int m=4,n=2,it=0,i;
15
 
  double *B;
16
 
  if (nrhs != 0) mexErrMsgTxt("Invalid number of inputs!");
17
 
  array_ptr = mxCreateFull(m,n,it);
18
 
  B = mxGetPr(array_ptr);  
19
 
  for (i=0 ; i < m*n ;i++ ) B[i]= (double) i;
20
 
  mexPutFull("C",&m,&n,B,NULL);
21
 
  mxFree(array_ptr);
22
 
}
23
 
 
24
 
 
25