Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6335697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:54:25+00:00 2026-05-24T18:54:25+00:00

So let’s start off by saying I’m a total beginner in matlab. I’m working

  • 0

So let’s start off by saying I’m a total beginner in matlab. I’m working with python and now I’ve recieved some data in a matlab file that I need to export to a format I could use with python.

I’ve googled around and found I can export a matlab variable to a text file using:

dlmwrite('my_text', MyVariable, 'delimiter' , ',');

Now the variable I need to export is a 16000 x 4000 matrix of doubles of the form 0.006747668446927. Now here is where the problem starts. I need to export the full values for each double. Trying with that function lead me to export the numbers in a format of 0.0067477. This won’t do since I need a whole lot more of precision for what I’m doing. So how can I export the full values of each of these variables? Or if you have a more elegant way of using that huge matlab matrix in python please feel free.

Regards,
Bogdan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:54:26+00:00Added an answer on May 24, 2026 at 6:54 pm

    To exchange big chunks of numerical data between Python and Matlab I
    recommend HDF5

    • http://en.wikipedia.org/wiki/Hierarchical_Data_Format

    The Python binding is called h5py

    • http://code.google.com/p/h5py

    Here are two examples for both directions. First from
    Matlab to Python

    % matlab
    points = [1 2 3 ; 4 5 6 ; 7 8 9 ; 10 11 12 ];
    hdf5write('test.h5', '/Points', points);
    

    # python
    import h5py
    with h5py.File('test.h5', 'r') as f:
        points = f['/Points'].value    
    

    And now from Python to Matlab

    # python
    import h5py
    import numpy
    points = numpy.array([ [1., 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12] ])
    with h5py.File('test.h5', 'w') as f:
        f['/Points'] = points
    

    % matlab
    points = hdf5read('test.h5', '/Points');
    

    NOTE A column in Matlab will come out as a row in Python and vice versa. This isn’t a bug but the difference between the way C and Fortran interpret a continuous piece of data in memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I'm building a data access layer for an application. Typically I have
Let me preface this question by saying I use TextMate on Mac OSX for
Let's say I have a text file composed like this ##### typeofthread1 ##### typeofthread2
Let's say there is a graph and some set of functions like: create-node ::
Let's assume that a user votes for some movies in a scale of 1
Let's say I have the string: hello world; some random text; foo; How could
Let say I have some code HTML code: <ul> <li> <h1>Title 1</h1> <p>Text 1</p>
Let's say i have this block of code, <div id=id1> This is some text
Let's say the Activity I want to start is named OccupyThePieShop I was previously
Let me start with explaining what I mean with magic. I will use two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.