Inserting a double into the elements of a cell

1 次查看(过去 30 天)
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 个评论
Cagas Akalin
Cagas Akalin 2017-1-15
I will be a answer to my own question. Replacing (k,l) with {k,l} gives me what I want to obtain.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by