フィルターのクリア

matrix equation in loop form

1 回表示 (過去 30 日間)
marwa hajji
marwa hajji 2022 年 5 月 8 日
コメント済み: Jan 2022 年 5 月 11 日
I would like to creat a matrix, by using the loop structure, because i have a very big values, I tried this code but no result ; any help please
A=[2 2 6 6 4 4;2 2 6 6 4 4]
for n=1:length(A)
for m=1:2
if n=1:2 & m=1:2
A=2
elseif n=3:4 & m=1:2
A=6
else
A=4
end
end
end
  8 件のコメント
Voss
Voss 2022 年 5 月 11 日
Maybe one of these is useful:
A = repelem([2 6 4],2,2)
A = 2×6
2 2 6 6 4 4 2 2 6 6 4 4
A = kron([1 3 2],2*ones(2))
A = 2×6
2 2 6 6 4 4 2 2 6 6 4 4
Jan
Jan 2022 年 5 月 11 日
Or:
repelem([2,4,6], 2, 2)
ans = 2×6
2 2 4 4 6 6 2 2 4 4 6 6

サインインしてコメントする。

回答 (0 件)

カテゴリ

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