Giter VIP home page Giter VIP logo

Comments (3)

arokem avatar arokem commented on May 22, 2024

Thanks for reporting - that does seem like a bug to me. Would be
non-trivial to fix, but let me take a look.

On Mon, Dec 1, 2014 at 6:30 PM, leizing [email protected] wrote:

However, what I got in MATLAB is a cell array, which flatten the matrix.
Assume the original matrix is 5 by 4, I end up with a 20 by1 cell array.
Moreover, all NaNs are treated as strings 'NaN' in the cell. A bug or it is
designed to be like this?


Reply to this email directly or view it on GitHub
#100.

from python-matlab-bridge.

lijing-lin avatar lijing-lin commented on May 22, 2024

In the following is a quick fix for myself. Say I pass float matrix S to matlab. I add the following lines before using the matrix:

%%matlab -i S
for i=1:length(S)
    if isnumeric(S{i}), continue, end
    S{i}(cellfun(@(x) ~isnumeric(x),S{i})) = {nan};
    S{i} = cell2mat(S{i});
end
S = cell2mat(S);

from python-matlab-bridge.

blink1073 avatar blink1073 commented on May 22, 2024

This behaviour is fixed in the latest master:

In [25]: S = np.ones((5,4), dtype=np.float64)

In [26]: S[0] = np.nan

In [27]: %%matlab -i S -o T
T = S;
   ....: 

In [28]: T
Out[28]: 
array([[ nan,  nan,  nan,  nan],
       [  1.,   1.,   1.,   1.],
       [  1.,   1.,   1.,   1.],
       [  1.,   1.,   1.,   1.],
       [  1.,   1.,   1.,   1.]])

from python-matlab-bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.