diff -r 62d1f56b0be7 src/load-save.cc --- a/src/load-save.cc Tue Oct 25 09:46:38 2011 -0700 +++ b/src/load-save.cc Thu Oct 27 13:25:55 2011 +0200 @@ -372,7 +372,8 @@ #ifdef HAVE_HDF5 case LS_HDF5: - name = read_hdf5_data (stream, orig_fname, global, tc, doc); + name = read_hdf5_data (stream, orig_fname, global, tc, doc, + argv, argv_idx, argc); break; #endif /* HAVE_HDF5 */ diff -r 62d1f56b0be7 src/ls-hdf5.cc --- a/src/ls-hdf5.cc Tue Oct 25 09:46:38 2011 -0700 +++ b/src/ls-hdf5.cc Thu Oct 27 13:25:55 2011 +0200 @@ -580,7 +580,8 @@ // and error. std::string read_hdf5_data (std::istream& is, const std::string& /* filename */, - bool& global, octave_value& tc, std::string& doc) + bool& global, octave_value& tc, std::string& doc, + const string_vector& argv, int argv_idx, int argc ) { std::string retval; @@ -599,6 +600,38 @@ #endif H5Gget_num_objs (group_id, &num_obj); H5Gclose (group_id); + + + // For large datasets and out-of-core functionality, + // check if only parts of the data is requested + bool testPatterns = argv_idx < argc; + while (testPatterns && hs.current_item < static_cast (num_obj)) + { + std::vector stringBuf; + bool found = false; + size_t len = 0; + + len = H5Gget_objname_by_idx( hs.file_id, hs.current_item, 0, 0); + stringBuf.resize( len+1 ); + H5Gget_objname_by_idx( hs.file_id, hs.current_item, &stringBuf[0], len+1); + + for (int i = argv_idx; i < argc; i++) + { + glob_match pattern (argv[i]); + if (pattern.match ( std::string(&stringBuf[0]) ) ) + { + found = true; + break; + } + } + + if ( found ) + break; + + hs.current_item++; + } + + if (hs.current_item < static_cast (num_obj)) H5Giterate_retval = H5Giterate (hs.file_id, "/", &hs.current_item, hdf5_read_next_data, &d); diff -r 62d1f56b0be7 src/ls-hdf5.h --- a/src/ls-hdf5.h Tue Oct 25 09:46:38 2011 -0700 +++ b/src/ls-hdf5.h Thu Oct 27 13:25:55 2011 +0200 @@ -180,7 +180,8 @@ extern OCTINTERP_API std::string read_hdf5_data (std::istream& is, const std::string& filename, bool& global, - octave_value& tc, std::string& doc); + octave_value& tc, std::string& doc, + const string_vector& argv, int argv_idx, int argc ); extern OCTINTERP_API bool save_hdf5_data (std::ostream& os, const octave_value& tc,