Extracting data from a structure

조회 수: 1 (최근 30일)
Andrew
Andrew 2013년 2월 1일
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.

채택된 답변

José-Luis
José-Luis 2013년 2월 1일
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);
  댓글 수: 1
Andrew
Andrew 2013년 2월 1일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Denoising and Compression에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by