The placement of a small array at the end of a structure and indexing into it is a common practice that is not supported by the C standard or by MATLAB. There are extensions that have been added to C99 for 'flexible array members' that MATLAB may not be able to support ether.
It is possible there may be a way to extract the data in pim using MATLAB but I am not sure. You may be better off creating a mex file that directly accesses libraw or using an entirely different way to load the image into MATLAB.
Things to try:
- If your images are all the same size then edit the header or prototype file to hard code the correct number of bytes for your camera.
- You may be able to use the reshape method on libpointer to change the size of data.