i m doing a project on digital watermarking in which i hav to divide a matrix in 2X4 submatrices. I m using the command mat2cell for this purpose but there is a problem in the execution of the command.

clc
clear all
X =imread('F:\M.TECH PROJECT\shri ram.jpg');
for i=1:111
j=1:97;
v(i,j) = 2;
end
v = v(i,j);
vsize=size(v)
for j=1:97
i=1:111;
w(i,j) = 7;
end
w=w(i,j)';
wsize=size(w)
[rows,cols] = size(X)
a=sum(v)
b=sum(w)
C = mat2cell(X,v,w);
% for i=1:rows
% for j=1:cols
% C{i,j}
% end
% end
As per the rules of the command the dimensions of the matrix should be equal to the total no. of rows and columns of the submatrices, i have done it accordingly.
Still the command is not working.

2 Comments

Is it producing an error, or is just not dividing the matrix the way you want?
You should display size(X) -- it might not be the same as what you expect from your line [rows,cols] = size(X)

Answers (0)

This question is closed.

Asked:

on 13 Apr 2013

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!