i have A=4*16384 double matrix and converted into 64*64 cell and each cell have again 4*4 double matrix ,now iam trying this below code
c = mat2cell(A,4,4*ones(64,64))
but it gives error
Error using mat2cell
Input arguments, D1 through D2, should be vectors.

댓글 수: 4

Geoff Hayes
Geoff Hayes 2019년 8월 29일
SRI - your third input is a 64x64 matrix but mat2cell is expecting this to be a vector. What dimensions of the cell matrix are you trying to get?
SRI
SRI 2019년 8월 29일
i want 64*64 cell output and each cell has again 4*4 cell double.
SRI
SRI 2019년 8월 29일
편집: SRI 2019년 8월 29일
sir actually before i have S=64*64 cell and each cell has 4*4 double,and i changed to matrix by using
A= [S{:}]; % i got dimensions like 4*16384 double
and i want changed A into S with dimensions 64*64 cell
Rik
Rik 2019년 9월 3일
Comment sent by email:
i have rgb image and now i converted into 64*64 cell and each cell block has 8*8*3 cell blocks but i want to apply iwt to each and every individual blocks and apply reverse process and i want retrieve original cell has 64*64 cell blocks...please give the solution sir...............
Which part is your actual question? Do you want to know how to apply a function to all elements of a cell array? Do you want to know how to redivide a cell array containing matrices?

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

 채택된 답변

Rik
Rik 2019년 8월 29일

1 개 추천

I'm going to assume you have 256x256 separated into 64x64 blocks and you want to redistribute to 4x4 blocks.
%create some data
data=reshape(1:(64*4)^2,64*4,64*4);
data=mat2cell(data,64*ones(1,4),64*ones(1,4));
A=cell2mat(data);%convert to a 256x26 matrix
B=mat2cell(A,4*ones(1,64),4*ones(1,64));%divide into 4x4 blocks

댓글 수: 1

SRI
SRI 2019년 8월 29일
wow,Great sir....
U are a great person thanks for helping me.I understand everything in a short time period.

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

추가 답변 (1개)

Bruno Luong
Bruno Luong 2019년 8월 29일
편집: Bruno Luong 2019년 8월 29일

2 개 추천

Depending on what you want as organization, either
C = mat2cell(reshape(A,4*64,4*64),4*ones(1,64),4*ones(1,64))
or
C = reshape(mat2cell(A,4,4*ones(1,64*64)),64,64) % EDIT: This is the reverse of A = [C{:}]
or ....

댓글 수: 7

SRI
SRI 2019년 8월 29일
sir,
C = mat2cell(reshape(A,4*64,4*64),4*ones(1,64),4*ones(1,64)) %1 command line
C = reshape(mat2cell(A,4,4*ones(1,64*64)),64,64) %2command line
Both command lines are converted into 64*64 cell and each have 4*4 double.But when i using 1st command line elements are mis ordered ,but 2nd command line was perfect code for my question sir.Thanks a lot sir ,U done fabolus work to me.
Bruno Luong
Bruno Luong 2019년 8월 29일
편집: Bruno Luong 2019년 8월 29일
Because the first command I wrote before you finally tell us (in your third comment) how A is obtained and you did not specify the order. Your original question is confusing.
SRI
SRI 2019년 8월 29일
Hoo,But thank u very much sir,Because without giving total clarification in my question but u give correct answer.
SRI
SRI 2019년 8월 29일
sir, your answer also correct but how to accept your answer also ,i dont know how to accept both answers in single question.
Bruno Luong
Bruno Luong 2019년 8월 29일
You accept which one is best for you.
I don't really care if my answer is not accepted as long as it is useful for you or somebody else.
Bruno Luong
Bruno Luong 2019년 8월 29일
편집: Bruno Luong 2019년 8월 29일
Why? You got your answer here, why should I post there (where the order is not specified)?
SRI
SRI 2019년 8월 29일
i want to accept both ur answers,beacuse you done great favout to me

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

카테고리

도움말 센터File Exchange에서 Time Series Objects에 대해 자세히 알아보기

제품

릴리스

R2016a

질문:

SRI
2019년 8월 29일

댓글:

Rik
2019년 9월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by