[Numpy-discussion] Structured array with no fields - possible?
S. Chris Colbert
sccolbert at gmail.com
Tue May 5 01:38:37 EDT 2009
you can create an array without changing the values of the allocated memory
by using numpy.empty() or numpy.ndarray()
this will allow you to create an array of any size without specifying the
contents beforehand.
I'm not sure what you mean by "empty", because any memory address will have
a value, whether its assigned to or not.
Chris
--------------------------------------------------
From: "Matthew Brett" <matthew.brett at gmail.com>
Sent: Tuesday, May 05, 2009 12:56 AM
To: "Discussion of Numerical Python" <numpy-discussion at scipy.org>
Subject: Re: [Numpy-discussion] Structured array with no fields - possible?
> Hi,
>
>>> I'm trying to fix a bug in the scipy matlab loading routines, and this
>>> requires me to somehow represent an empty structured array.
>>>
>>
>> Do you need the struct to be empty (size is 0) or to have no fields ?
>> What would you expect np.zeros((), dtype=np.dtype([])) to return, for
>> example ?
>
> Yes, I've got nothing - I have no idea what that might return.
>
> I'm afraid what I need is some way of representing the fact that I
> have read, from matlab, a structure with no fields (and therefore no
> data) that can be - say - shape (10,2) - or any other.
>
> Some time ago we thought of switching to structured arrays to
> represent matlab structs, but this begins to make me think again.
>
> Thanks for the replies,
>
> Matthew
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list