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);
3 个评论
更多回答(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!