Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dimension of cellarrays #19

Closed
andrescodas opened this issue Jan 18, 2017 · 2 comments
Closed

dimension of cellarrays #19

andrescodas opened this issue Jan 18, 2017 · 2 comments

Comments

@andrescodas
Copy link
Contributor

Hi,

There are issues when converting a cell array with matrices of the same size from matlab to python. The shape of the cell elements are interpreted together with the shape of the cell itself. Then there is a bug on the reshape command.

You implemented a fix for this case for the conversion of structs but not for the cell arrays.

I recommend you to implement the handling of cells in this way:

elif class_name == 'cell':
    out = np.empty(numelems,dtype='O')
    for i in range(numelems):
        cell = libmx.mxGetCell(pm, i)

        if bool(cell):
            out[i] = mxarray_to_ndarray(libmx, cell)
        else:
            ### uninitialized cell
            out[i] = None
      
    out = out.reshape(dims[:ndims], order='F')
    out = out.squeeze()
@mrkrd
Copy link
Owner

mrkrd commented Jan 19, 2017 via email

@mrkrd
Copy link
Owner

mrkrd commented Jan 22, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants