[SciPy-User] empty array and loadmat

Matthew Brett matthew.brett at gmail.com
Tue Jan 25 14:32:28 EST 2011


On Tue, Jan 25, 2011 at 10:29 AM, Matthew Brett <matthew.brett at gmail.com> wrote:
> Hi,
>
>> I'm trying to open EEGlab files using loadmat. EEGLab is a matlab
>> toolbox processing continuous and event-related EEG, MEG and other
>> electrophysiological data.
>> But some of my fields in the EEGlab structure are empty and loadmat
>> fails.
>>
>> my error :
>>
>> In [6]: test = scipy.io.loadmat('EMG_all.set',appendmat=False)
>>
>> [...]
>> /usr/lib/python2.6/dist-packages/scipy/io/matlab/miobase.py in
>> chars_to_str(self, str_arr)
>>    336     def chars_to_str(self, str_arr):
>>    337         ''' Convert string array to string '''
>> --> 338         dt = np.dtype('U' + str(small_product(str_arr.shape)))
>>    339         return np.ndarray(shape=(),
>>    340                           dtype = dt,
>>
>> TypeError: data type not understood
>
> Thanks for the report, and the file, that's very helpful.  I'm getting
> a different error in the latest scipy dev version, but there's clearly
> a problem, I will try and look at it today.

Boils down to:

octave-3.2.3:59> load Downloads/EMG_all.set
octave-3.2.3:60> var = EEG.urevent(2).type;
octave-3.2.3:61> whos var
Variables in the current scope:

  Attr Name        Size                     Bytes  Class
  ==== ====        ====                     =====  =====
       var         1x0                          0  char

Total is 0 elements using 0 bytes

octave-3.2.3:62> save one_by_zero_char.mat var -6

Matthew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: one_by_zero_char.mat
Type: application/octet-stream
Size: 184 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110125/79e4a7a5/attachment.obj>


More information about the SciPy-User mailing list