I would like to shorten the code, but keep the same type and size of the variable N{t}{w}(i).

2 ビュー (過去 30 日間)
Nebojsha
Nebojsha 2023 年 5 月 29 日
編集済み: Walter Roberson 2023 年 5 月 29 日
for t = 1:3
for w = 1:3
for i=1:10
N{t}{w}(i) = 0;
end
end
end

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 5 月 29 日
編集済み: Walter Roberson 2023 年 5 月 29 日
N = repmat({repmat({zeros(1,10)}, 1, 3)}, 1, 3)
N = 1×3 cell array
{1×3 cell} {1×3 cell} {1×3 cell}

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by