Inserting a double into the elements of a cell

1 回表示 (過去 30 日間)
Cagas Akalin
Cagas Akalin 2017 年 1 月 15 日
コメント済み: Cagas Akalin 2017 年 1 月 15 日
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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by