"be*******@aol. com" wrote:
Sub print_matrix(xm at() As Double)
Debug.Print UBound(xmat, 1), UBound(xmat, 2)
'do stuff with xmat
End Sub
It is trivial to allocate and pass multidimensiona l arrays in VBA, but
C requires expertise with pointers. The subroutine print_matrix can
query the dimensions of xmat, so they don't need to be passed as
separate arguments, as in C. The fact that is tricky to do simple
things is a sign of the poor design of C
Sounds more like poor C skills on your part. Here's a snippet from the Python
Imaging Library which takes a 2D array (im) and creates another one (imOut).
Imaging
ImagingRankFilt er(Imaging im, int size, int rank)
{
Imaging imOut = NULL;
int x, y;
int i, margin, size2;
/* check image characteristics */
if (!im || im->bands != 1 || im->type == IMAGING_TYPE_SP ECIAL)
return (Imaging) ImagingError_Mo deError();
/* check size of rank filter */
if (!(size & 1))
return (Imaging) ImagingError_Va lueError("bad filter size");
size2 = size * size;
margin = (size-1) / 2;
if (rank < 0 || rank >= size2)
return (Imaging) ImagingError_Va lueError("bad rank value");
/* create output image */
imOut = ImagingNew(im->mode, im->xsize - 2*margin, im->ysize - 2*margin);
if (!imOut)
return NULL;
... actual algorithm goes here ...
return imOut;
}
The "im" input object carries multidimensiona l data, as well as all other properties
needed to describe the contents. There are no separate arguments for the image
dimensions, nor any tricky pointer manipulations. A Python version of this wouldn't
be much different.
</F>