3

i have a cell array with elements 22*22,18*18*6,14*14*6,10*10*6,6*6*6.can u please help me to initialize it

Update:

s{l(:,:,feature_map)=zeros(22,22),zeros(18,18,6),zeros(14,14,6),zeros(10,10,6),zeros(6*6*6)

By using the above command first element of cell array is empty.all other elements have 22*22*6 elements.it'l create problems in convolution

code is:

num_of_maps_in_layer{1}=1;
for i=1:3
    num_of_maps_in_layer{i+1}=6; 
end
num_of_maps_in_layer{5}=6; 

for l=2:5
    for feature_map=1:num_of_maps_in_layer{l}
        sensitivity{l}(:,:,feature_map)=zeros(22,22),zeros(18,18,6),zeros(14,14,6),zeros(10,10,6),zeros(6*6*6)
    end
end
4
  • @user689593: Please read through some of these resources: How to ask a smart question?, Style guide for questions and answers, How To Ask Questions The Smart Way Commented Apr 5, 2011 at 15:44
  • In your example, what is l? What is feature_map? What do you want s and its contents to look like (i.e. size, number of dimensions, etc.)? These are the details we need from you, otherwise we're just making blind stabs in the dark. Commented Apr 5, 2011 at 16:06
  • i had edited.please help Commented Apr 5, 2011 at 16:18
  • @user689593: When you make considerable modifications to your question, please do it such way that it's obvious related to earlier answers. Thanks Commented Apr 5, 2011 at 17:12

3 Answers 3

2

I think this is what you want to do:

sensitivity = {zeros(22,22),...
               zeros(18,18,6),...
               zeros(14,14,6),...
               zeros(10,10,6),...
               zeros(6,6,6)};

This creates a 5-element cell array sensitivity. The first cell contains a 22-by-22 numeric array of zeroes, the second cell contains an 18-by-18-by-6 numeric array of zeroes, etc.

Sign up to request clarification or add additional context in comments.

Comments

1

Not sure what you want to initialize the matrices with, but if you just want do declare them and don't really care what they contain, you could do

ones(22, 22)
ones(18,18,6)
ones(14,14,6)
...

or you could use zeros function for 0-filled matrices.

1 Comment

s{l}(:,:,feature_map)=zeros(22,22),zeros(18,18,6),zeros(14,14,6),zeros(10,10,6),zeros(6*6*6). by using the above command first element of cell array is empty.all other elements have 22*22*6 elements.it'l create problems in convolution.please help
1

By any change did you meant by initialization something like this:

1> ca= {22* 22, 18* 18* 6, 14* 14* 6, 10* 10* 6, 6* 6* 6}
ca =
{
  [1,1] =  484
  [1,2] =  1944
  [1,3] =  1176
  [1,4] =  600
  [1,5] =  216
}

1 Comment

sensitivity{l}(:,:,feature_map)=zeros(22,22),zeros(18,18,6),zeros(14,14,6),zeros(10,10,6),zeros(6*6*6). can u please correct this?first element of cell array is empty.all other elements have 22*22*6 elements.it'l create problems in convolution.please help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.