How can I make my values become positive?
조회 수: 129 (최근 30일)
이전 댓글 표시
I have array values and I need to know which command I should use to make my values become positive and how can I find the mean of all array values?
Thanks.
댓글 수: 0
채택된 답변
Alfonso
2018년 6월 16일
편집: Alfonso
2018년 6월 16일
% Example: 3x2 array
myArray = [-1,-2;-3,2;-3,-4];
% Make all values in array positive
myArray = abs(myArray);
% Mean value of array
m = mean(myArray) % m returns a row vector where each column is the mean of each column of your array
% If you want a single mean value for all values of your array
% concatenate values in a single row
array = [myArray(:,1); myArray(:,2)];
m_all = mean(array);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!