Inserting a double into the elements of a cell

1 Ansicht (letzte 30 Tage)
Cagas Akalin
Cagas Akalin am 15 Jan. 2017
Kommentiert: Cagas Akalin am 15 Jan. 2017
Hi everyone,
I would like to ask for your opinions assocaiated with creating a cell in which each box includes 1x2 array such that is [1 2]. For this purpose, I tried a four-loop which is as follows.
for i = 1:11
for j = 1:11
for k = 1:11
for l = 1:11
b{i,j}(k,l)=[1 2];
end
end
end
end
As you guess, it gives the warning "Subscripted assignment dimension mismatch.". On the other hand, replacing [1 2] with 3 nearly yields to what I would like to create without any error.
for i = 1:11
for j = 1:11
for k = 1:11
for l = 1:11
b{i,j}(k,l)=3;
end
end
end
end
Is there any possibility to solve this problem?
  1 Kommentar
Cagas Akalin
Cagas Akalin am 15 Jan. 2017
I will be a answer to my own question. Replacing (k,l) with {k,l} gives me what I want to obtain.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by