comp.lang.ada
 help / color / mirror / Atom feed
* Ada library to read/write matlab files?
@ 2013-10-16 15:33 mockturtle
  2013-10-16 19:32 ` Per Sandberg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mockturtle @ 2013-10-16 15:33 UTC (permalink / raw)


Dear.all,
the subject says everything. 
Are you aware of an available library to read/write matlab (binary) files? I tried googling around a bit (just a bit) without finding anything.  
As an alternative, something to read/write HDF or CDF (not netCDF since it requires a specific matlab package [if I remember correctly...]).  

I would like something "independent", that is, interfacing with other libraries (e.g., matlab API) is something I would rather avoid.

Regards

Riccardo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada library to read/write matlab files?
  2013-10-16 15:33 Ada library to read/write matlab files? mockturtle
@ 2013-10-16 19:32 ` Per Sandberg
  2013-10-17  8:19 ` Maurizio Tomasi
  2013-10-18 20:09 ` mockturtle
  2 siblings, 0 replies; 4+ messages in thread
From: Per Sandberg @ 2013-10-16 19:32 UTC (permalink / raw)


On Wed, 16 Oct 2013 08:33:16 -0700 (PDT)
mockturtle <framefritti@gmail.com> wrote:
One suggestion could be:
* get cdf35_0-dist-all.tar.gz from
    http://cdaweb.gsfc.nasa.gov/pub/software/cdf/dist/cdf35_0/w32/src_distribution/

* Compile and install that library
* make a small c-file containing "#include <cdf.h>"
* compile that file with 
     g++ -c -I 'path to cdf includes' -fdump-ada-spec
* and magic there is an cdf_h.ads.
     Given that the gcc you are using is modern.

/Per

> Dear.all,
> the subject says everything. 
> Are you aware of an available library to read/write matlab (binary)
> files? I tried googling around a bit (just a bit) without finding
> anything. As an alternative, something to read/write HDF or CDF (not
> netCDF since it requires a specific matlab package [if I remember
> correctly...]).  
> 
> I would like something "independent", that is, interfacing with other
> libraries (e.g., matlab API) is something I would rather avoid.
> 
> Regards
> 
> Riccardo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada library to read/write matlab files?
  2013-10-16 15:33 Ada library to read/write matlab files? mockturtle
  2013-10-16 19:32 ` Per Sandberg
@ 2013-10-17  8:19 ` Maurizio Tomasi
  2013-10-18 20:09 ` mockturtle
  2 siblings, 0 replies; 4+ messages in thread
From: Maurizio Tomasi @ 2013-10-17  8:19 UTC (permalink / raw)


On Wednesday, October 16, 2013 5:33:16 PM UTC+2, mockturtle wrote:
> Are you aware of an available library to read/write matlab (binary) files? I tried googling around a bit (just a bit) without finding anything.  
> 
> As an alternative, something to read/write HDF or CDF (not netCDF since it requires a specific matlab package [if I remember correctly...]).  
> 
> I would like something "independent", that is, interfacing with other libraries (e.g., matlab API) is something I would rather avoid.

I am not a Matlab user, but I know it can handle FITS files. So you might want to give a try to my library AdaFITS:

https://github.com/ziotom78/adafits

However, I am not sure it will fit your needs, as it has the following caveats:

1. It requires CFITSIO to be installed, so it is not "independent". However, CFITSIO is available in binary form for a variety of platforms.
2. It only reads ASCII/binary tables, there is no support (yet) for reading/writing images.
3. It requires an Ada2012 compiler (but I think should be trivial to make it work with an Ada2005 compiler, and it is definitively something I'll eventually fix).

Maurizio.

P.S. I too am interested in HDF5 bindings for Ada. I have already generated thin bindings using the gcc's trick suggested by Per Sandberg, but I surely will put some more work in them in order to make them easier to use.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada library to read/write matlab files?
  2013-10-16 15:33 Ada library to read/write matlab files? mockturtle
  2013-10-16 19:32 ` Per Sandberg
  2013-10-17  8:19 ` Maurizio Tomasi
@ 2013-10-18 20:09 ` mockturtle
  2 siblings, 0 replies; 4+ messages in thread
From: mockturtle @ 2013-10-18 20:09 UTC (permalink / raw)


Dear Maurizio,
Dear Per,
thank you for your replies and suggestions.  Unfortunately, my constraint of having a pure Ada solution was fairly strong (for reasons too long to explain here), so  I "throw together" a solution good enough for me.  

I am making it available through launchpad and I insert here a shameless link to it :-) 

         https://launchpad.net/adamant

in case in the future someone will search through the newsgroup again.

Currently it is very limited (but you can copy it! :-)  [did you get the joke? no?!? Then, what are you doing in this newsgroup? :-) :-) :-) ]  
It allows you only to write Matlab files and only matrices of double (of any dimensionality) and strings.  Cells, structs and reading are for a future release (maybe) 

It requires Ada 2012 since I spotted the occasion of using a dynamic predicate  (too cool!).  If you want to use it with a non Ada 2012 compiler, just go to the specs of Matlab.IO and remove the predicate from Matlab_Name.

Riccardo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-18 20:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 15:33 Ada library to read/write matlab files? mockturtle
2013-10-16 19:32 ` Per Sandberg
2013-10-17  8:19 ` Maurizio Tomasi
2013-10-18 20:09 ` mockturtle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox