Thread Subject: HDF5 Library

Subject: HDF5 Library

From: mini

Date: 12 Apr, 2009 13:12:02

Message: 1 of 12

Hi,

I'm currently working on a way to use the HDF5 library (obtained from
http://www.hdfgroup.org - i want to use the C - library) inside a MATLAB S-function (level 2 C function).

I have to downloaded the libraray including the all the dlls and header files but I have no idea how to include them in my code (MATLAB mex file).

I wonder if someone has an idea how this could be done?

Thanks for your time and help

best regards,

Thomas

Subject: HDF5 Library

From: Ralph Schleicher

Date: 12 Apr, 2009 18:54:33

Message: 2 of 12

"mini" <thomas.minarik@gmail.com> writes:

> I'm currently working on a way to use the HDF5 library (obtained from
> http://www.hdfgroup.org - i want to use the C - library) inside a
> MATLAB S-function (level 2 C function).

I've written a sophisticated data logging S-function using a
HDF5 data file. I've also written a HDFView plug-in do format
the data nicely.

> I have to downloaded the libraray including the all the dlls and
> header files but I have no idea how to include them in my code (MATLAB
> mex file).

In the source code:

     #include <hdf5.h>

Compilation:

     mex ... -lhdf5 -lz

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Subject: HDF5 Library

From: Chaos

Date: 12 Apr, 2009 22:58:01

Message: 3 of 12

Ralph Schleicher <rs@ralph-schleicher.de> wrote in message <87myal7lee.fsf@echo.mueller-schleicher.i>...
> "mini" <thomas.minarik@gmail.com> writes:
>
> > I'm currently working on a way to use the HDF5 library (obtained from
> > http://www.hdfgroup.org - i want to use the C - library) inside a
> > MATLAB S-function (level 2 C function).
>
> I've written a sophisticated data logging S-function using a
> HDF5 data file. I've also written a HDFView plug-in do format
> the data nicely.
>
> > I have to downloaded the libraray including the all the dlls and
> > header files but I have no idea how to include them in my code (MATLAB
> > mex file).
>
> In the source code:
>
> #include <hdf5.h>
>
> Compilation:
>
> mex ... -lhdf5 -lz
>
> --
> Ralph Schleicher <http://ralph-schleicher.de>
>
> Development * Consulting * Training
> Mathematical Modeling and Simulation
> Software Tools

could you use HDF5 to store say a stack of 5000 HD 1920 x 1080 uint16 images, Y16, and 'play' them back in a viewer at 24fps? assuming the images are not compressed.

Subject: HDF5 Library

From: Chaos

Date: 13 Apr, 2009 01:34:01

Message: 4 of 12

"Chaos" <rothko.fan@gmail.com> wrote in message
>
> could you use HDF5 to store say a stack of 5000 HD 1920 x 1080 uint16 images, Y16, and 'play' them back in a viewer at 24fps? assuming the images are not compressed.

also want to add 5 channels of PCM 24bit 96kHz, can you mux these two with the player.

Subject: HDF5 Library

From: Ralph Schleicher

Date: 13 Apr, 2009 08:55:29

Message: 5 of 12

"Chaos" <rothko.fan@gmail.com> writes:

> also want to add 5 channels of PCM 24bit 96kHz, can you mux these two
> with the player.

As said before, amount of data is not an issue for HDF5 as long as you
do not ran out of disk space.

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Subject: HDF5 Library

From: Ralph Schleicher

Date: 13 Apr, 2009 08:52:53

Message: 6 of 12

"Chaos" <rothko.fan@gmail.com> writes:

> could you use HDF5 to store say a stack of 5000 HD 1920 x 1080 uint16
> images, Y16, and 'play' them back in a viewer at 24fps? assuming the
> images are not compressed.

That's only 20 GB of data; peanuts for HDF5. But then I would
convert the single images into a movie and play it with standard
software player.

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Subject: HDF5 Library

From: Chaos

Date: 13 Apr, 2009 09:40:02

Message: 7 of 12

Ralph Schleicher <rs@mueller-schleicher.de> wrote in message <87iql96il6.fsf@echo.mueller-schleicher.i>...
> "Chaos" <rothko.fan@gmail.com> writes:
>
> > could you use HDF5 to store say a stack of 5000 HD 1920 x 1080 uint16
> > images, Y16, and 'play' them back in a viewer at 24fps? assuming the
> > images are not compressed.
>
> That's only 20 GB of data; peanuts for HDF5. But then I would
> convert the single images into a movie and play it with standard
> software player.
>
> --
> Ralph Schleicher <http://ralph-schleicher.de>
>
> Development * Consulting * Training
> Mathematical Modeling and Simulation
> Software Tools

Thanks Ralph,

All the standard players and compressors don't support Y16 or uint16 at all, even Matlab's get frame reduces down to Y8, or uint8. Blu-Ray, DVD format are all 8-bit, so I'm looking for a way to keep the precision so that the noise floor is in the dirt. Very few if any support 24-bit/96kHz audio.



cheers

Subject: HDF5 Library

From: mini

Date: 14 Apr, 2009 13:02:02

Message: 8 of 12

Hi,
Thank you for all your help so far but I just don't get it running.

When I try to compile the file with: [mex file.c -I"include path" -L"libpath" -lhdf5]
I always get error messages telling me that something is wrong in the header files like (Error C:\DOCUME~1\MINI\MYDOCU~1\MATLAB\hdf5savetest.c: C:\DOCUME~1\MINI\DESKTOP\5-182-~1\INCLUDE\H5Opublic.h: 96 syntax error; found `time_t' expecting `}' )

I don't think the there is an error in the release version of hdf5.

Any ideas what I could do?

thanks for your help again.

best regards,

Thomas

Subject: HDF5 Library

From: Chaos

Date: 14 Apr, 2009 16:48:01

Message: 9 of 12

"mini" <thomas.minarik@gmail.com> wrote in message <gs21ga$ivc$1@fred.mathworks.com>...
> Hi,
> Thank you for all your help so far but I just don't get it running.
>
> When I try to compile the file with: [mex file.c -I"include path" -L"libpath" -lhdf5]
> I always get error messages telling me that something is wrong in the header files like (Error C:\DOCUME~1\MINI\MYDOCU~1\MATLAB\hdf5savetest.c: C:\DOCUME~1\MINI\DESKTOP\5-182-~1\INCLUDE\H5Opublic.h: 96 syntax error; found `time_t' expecting `}' )

why do you have different paths for src and includes?

there is probably an error in the mexopt.bat, as there are many.

put the HDF in a common location to make life easy where you don't have to expand the paths.

set HDF=c:\HDF
set lib=%HDF%/lib;%lib%
set bin etc
set inc etc

%MATLAB%\extern\lib\win32\microsoft make sure this is in the linkflags somewhere, it looks like its not finding the winblows headers,

i've not compiled HDF on windoze, it works find on unix, freebsd and linux with no problems. you may end up having to download SDK R2 to get the correct windows headers.

Subject: HDF5 Library

From: Ralph Schleicher

Date: 14 Apr, 2009 17:32:01

Message: 10 of 12

"mini" <thomas.minarik@gmail.com> writes:

> When I try to compile the file with: [mex file.c -I"include path"
> -L"libpath" -lhdf5] I always get error messages telling me that
> something is wrong in the header files like (Error
> C:\DOCUME~1\MINI\MYDOCU~1\MATLAB\hdf5savetest.c:
> C:\DOCUME~1\MINI\DESKTOP\5-182-~1\INCLUDE\H5Opublic.h: 96 syntax
> error; found `time_t' expecting `}' )

The binary distribution was build with another compiler than you have.
Therefore the HDF5 configuration is crippled (yes, this is an example
for bad interface design).

You have three options.

1. Edit 'H5pubconf.h' to match your setup.
2. Add a '#include <sys/types.h>' or '#include <time.h>' to the
   source code before '#include <hdf5.h>'.
3. Say 'mex -DH5_HAVE_SYS_TYPES ...' or something similar to fix
   it from the command line.

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Subject: HDF5 Library

From: Ashish Uthama

Date: 14 Apr, 2009 21:07:36

Message: 11 of 12

On Sun, 12 Apr 2009 09:12:02 -0400, mini <thomas.minarik@gmail.com> wrote:

> Hi,
>
> I'm currently working on a way to use the HDF5 library (obtained from
> http://www.hdfgroup.org - i want to use the C - library) inside a MATLAB
> S-function (level 2 C function).
>
> I have to downloaded the libraray including the all the dlls and header
> files but I have no idea how to include them in my code (MATLAB mex
> file).
>
> I wonder if someone has an idea how this could be done?
>
> Thanks for your time and help
>
> best regards,
>
> Thomas

Thomas,

I am not too familar with S-functions, but cant you write S functions in M?

In which case, would the HDF5 low-level functions in MATLAB help?
http://www.hdfgroup.uiuc.edu/UserSupport/examples-by-api/api16-m.html

Subject: HDF5 Library

From: Ralph Schleicher

Date: 15 Apr, 2009 18:10:12

Message: 12 of 12

"Ashish Uthama" <first.last@mathworks.com> writes:

> In which case, would the HDF5 low-level functions in MATLAB help?

Far too slow for real work. My HDF5 data logging S-function has a speed
penalty of approx. 5 % when recording 10000+ Simulink signals.

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
hdf5 mini 12 Apr, 2009 09:15:04
dll mini 12 Apr, 2009 09:15:04
mex mini 12 Apr, 2009 09:15:04
rssFeed for this Thread

Contact us at files@mathworks.com