Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: dieter Newsgroups: comp.lang.python Subject: Re: HDF5 data set, unable to read contents Date: Fri, 11 Mar 2016 10:37:37 +0100 Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de +DFNarFtLCiQq3ThzRTjFQiqPSF3c7Xxn+AR8hmcFX7g== Cancel-Lock: sha1:aIIkDk76ZEarA6XRn2PT4vzHhDM= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'converts': 0.07; 'api': 0.09; "object's": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:set': 0.09; 'python': 0.10; 'python.': 0.11; 'attributes).': 0.16; 'printout': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'reproducing': 0.16; 'simplifies': 0.16; 'string': 0.17; 'element': 0.18; 'extension': 0.20; '(by': 0.22; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; '(such': 0.27; 'defining': 0.27; '(it': 0.29; "i'm": 0.30; 'print': 0.30; 'help,': 0.32; 'so,': 0.35; 'files,': 0.35; 'i.e.': 0.35; 'interact': 0.35; 'saved': 0.35; 'there': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'charset :us-ascii': 0.37; 'creation': 0.38; 'itself': 0.38; 'data': 0.39; 'format': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'called': 0.40; 'some': 0.40; 'email addr:gmail.com': 0.62; 'show': 0.62; 'details': 0.62; 'matrix.': 0.84; 'subject:read': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57b38999.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104604 varun7rs@gmail.com writes: > I recently came across a package called matrix2latex which simplifies the creation of very large tables. So, I saved my data in .mat format using the '-v7.3' extension so that they can be read by python. > > Now, when I try to read these files, I'm having some problems in reproducing the whole matrix. Whenever I try and print out an element of the array, I only get 'HDF5 object reference' as the output. "print" implicitely converts an object to a string. As there are a huge number of potential object types, "print" itself cannot know all the relevant details regarding string convertion for all types -- each individual type must help (by defining "__str__" and/or "__repr__"). If it does not help, you get a printout as the above. In an interactive Python session, you can use "help(...)" on one of those "HDF5 object reference"s. This will show you the API of the object - i.e. how to interact with the object (such as accessing/modifying the contained information). "vars(...)" may also help (it shows the object's (instance) attributes).