MATLAB Answers

0

how to average num of column for each row?

Asked by Lola SE on 23 Aug 2017
Latest activity Answered by José-Luis
on 23 Aug 2017
Hi all,
Thank for the help in advance.
I have a matrix in dim. of 972 (rows) * 715 (columns) I want to make an average of each row then divided by the num of columns. the final matrix should be 972*1 could any one help me with this? in for loop (because I will apply it in addition for other matrices)
thank you so much.

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by José-Luis
on 23 Aug 2017
 Accepted Answer

Taking your question literally would yield:
dummy = rand(972,215);
result = mean(dummy,2) ./ size(dummy,2)

  0 Comments

Sign in to comment.


Answer by KSSV
on 23 Aug 2017

doc mean you can specify the dimension there and get what you want.
A = rand(972,715) ;
M = mean(A,2) ;

  0 Comments

Sign in to comment.