## Extracting data from a structure

on 1 Feb 2013

### José-Luis (view profile)

I have performed DCT on an image(256×256) and the the compressed data is saved in a file. When i open this file in workspace, the compressed file is a 32×32 structure, with cells, each containing binary digits of different lengths(some more than 128) for each cell. I would like to extract these digits and align them in 1 matrix, however i do not know how to do this. Can you please advise me on how to solve this problem in matlab.

## Products

No products are associated with this question.

### José-Luis (view profile)

on 1 Feb 2013

I am not sure I understand your question. But if what you mean is that you have a cell array of structures and that you want to extract one element from each structure, then you could do as follows:

a.whatever = 125; %some structure
your_cell = cell(10,5);
your_cell(:) = {a};
your_mat = cellfun(@(x) x.whatever,your_cell);

Andrew

### Andrew (view profile)

on 1 Feb 2013

Thank you for the feedback. Just to make it more clear(sorry if i was vague), i would like to extract every digit in each of the structures so that i form one big matrix. e.g cell(1,1) contains about this (111000000110000001100000010000111000)binary digits, so i would like to extract all of them and all the other from each of the remaining cells so that i can form one big matrix of all those. My aim is to have this data being able to be read in a c++ code which inputs 256*256 image data. that is why i want to extract all these digits since the code wont function when the data is still in the structure form. Just in case, the code is here (<http://ge.tt/7q04jkV/v/1>) and the compressed data is "I_runcode" Thank you again

#### Join the 15-year community celebration.

Play games and win prizes!

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi