MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Reading arrays in mathlink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30069] Reading arrays in mathlink
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Thu, 26 Jul 2001 01:20:05 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

How does one read an array in Mathlink whose entries are either real or
complex?

I am trying the following seqeunce

int r,c,i,j,args;
char *sym;
double val;

MLCheckFunction( stdlink, "List", &r)
for (i=0; i<r; i++) {
    MLCheckFunction( stdlink, "List", &c);
    for (j=0,j<c,j++) {
        MLGetFunction( stdlink, &sym, &args);
        switch (args) {
            case 1 :
                MLGetReal( stdlink, &val);
                break;
            case 2 :
                MLGetReal( stdlink, &val); /* Get real part*/
                MLGetReal( stdlink, &val); /* Get imaginary part*/
                break;
        }
    }
}

The connection dies for some reason.  I have no idea why,



  • Prev by Date: NDSolve does not let me to stop
  • Next by Date: Element-by-element Matrix Multiplication
  • Previous by thread: Re: NDSolve does not let me to stop
  • Next by thread: Element-by-element Matrix Multiplication