summation of matrix function
조회 수: 6 (최근 30일)
Vilém Frynta 2023년 4월 8일
this looks like homework.
i'll try to guide you, but be aware that you won't learn anything by letting others do your homework for you.
m = randi(10, [8 8]) % 8x8 matrix
if you use sum() on the whole matrix, you would get sums from all the columns. if you only want to get sum from specific columns, you can specify that by indexing.
sum(m(:,1)) % sum of all rows from column 1
if you wish to make sums of rows, you will need to rotate (transpose) the matrix.