Inserting a double into the elements of a cell

1 vue (au cours des 30 derniers jours)
Cagas Akalin
Cagas Akalin le 15 Jan 2017
Commenté : Cagas Akalin le 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 commentaire
Cagas Akalin
Cagas Akalin le 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by