0

I'm trying to find something similar in MATLAB to PyTables' table.where that selects a subset of a dataset based on criteria (such as col1 = 4). So far, my searching has been completely fruitless. I can't believe such a useful feature wouldn't be supported somehow... can anyone help?

MATLAB ver R2011b.

EDIT: In case it wasn't clear from the question, I'm using an HDF5 file for data storage in MATLAB, hence my desire to find functionality similar to PyTables.

Amro
  • 123,847
  • 25
  • 243
  • 454
uscere90
  • 543
  • 1
  • 5
  • 12
  • How do you load that HDF5 format files in matlab? – Oli Jun 16 '12 at 11:32
  • @uscere90: what exactly are you looking for, a [dataset](http://www.mathworks.com/help/toolbox/stats/dataset.html) type in MATLAB, or a way to manipulate [HDF5](http://www.mathworks.com/help/techdoc/ref/hdf5.html) files? – Amro Jun 16 '12 at 18:05
  • @Amro I'm looking for a way to manipulate hdf5 files. The file I'm working with is too large to load all into ram at once. I grab a 3d chunk containing the data I want, and then I search through it once matlab has it in memory. I was hoping I could do it with more elegance, a la pytables' table.where that just returns your matching data right away. – uscere90 Jun 18 '12 at 15:41

1 Answers1

0

I think what you try to do involves either load-ing the file in memory (or you might give HDF5 Diskmap Class a try if it's to big for memory).

Once you have access to your data in matlab as a matrix, it's easy as:

a=[
0 0 0 0 1;
0 1 0 0 1;
1 0 1 1 1;
0 1 1 1 1;
1 0 1 0 1];

a(find(a(:,1)==1),:)
jpjacobs
  • 9,359
  • 36
  • 45
  • Indeed, this is essentially what I'm doing now. I was hoping there was an hdf5 function that would only return the matching data, instead of having to load a large gob that's guaranteed to contain the data I want, and then search through it to find it. – uscere90 Jun 18 '12 at 15:41
  • It seems that hdf5read can read out one column of data. That should at least reduce your load. Then you can keep indices matching your criteria, and load those afterwards. – jpjacobs Jun 18 '12 at 18:04