Make an array Arr where element Arr(m,n)=i(m)+j(n)*i(m), and i is changing from -5 to 20 and j is changing from -13 to 9.

3 ビュー (過去 30 日間)
nty huy
nty huy 2019 年 10 月 7 日
回答済み: Joe Vinciguerra 2019 年 10 月 7 日
can somone help me with this, i know basic arrays which are [- 5 5 10 15 20]
but this array is a little diffrent

回答 (1 件)

Joe Vinciguerra
Joe Vinciguerra 2019 年 10 月 7 日
Make a nested For Loop with a loop for each dimension. Something like this:
for ii = 1:26
i = ii-6;
for jj = 1:23
j = jj-14;
Arr(ii,jj)=i+j*i;
end
end
For more information and another example see here: https://www.mathworks.com/help/matlab/ref/for.html#buhafti-1

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by