フィルターのクリア

adding element to a matrix row

9 ビュー (過去 30 日間)
bbah
bbah 2019 年 11 月 20 日
コメント済み: KALYAN ACHARJYA 2019 年 11 月 20 日
hi,
i want to add to a matrix edhe next element to the next column
e.g
calculate an element
add to position matrix(1,1)
calculate next element
add to position matrix(1,2)
...
jump to next row and do the same ...
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 11 月 20 日
Hints:
element=calculate the element
for i=1:r
for j=1:c
mat(i,j)=element
element=calculate the element
end
end

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

採用された回答

M
M 2019 年 11 月 20 日
You can read this to know about matrix indexing:
You can do something like:
m = nbRow;
n = nbCol;
M = zeros(m,n);
for i = 1 : nbRow
for j = 1 : nbCol
a = i + j ;% some calculation
M(i,j) = a;
end
end

その他の回答 (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