Calculate mean value of every element of a .mat file

조회 수: 8 (최근 30일)
Jon Ordóñez Devesa
Jon Ordóñez Devesa 2022년 5월 20일
댓글: Jon Ordóñez Devesa 2022년 5월 23일
I have a .mat file which contains 300 matrixes all of which have the same dimensions of 256x320. I want to calculate the mean value of each matrix, with a for circle maybe, thus obtaining 300 vectors. Then I want to put all those vectors in a single matrix. Thanks in advance.
  댓글 수: 2
KSSV
KSSV 2022년 5월 20일
Load the data and use mean.
Matt J
Matt J 2022년 5월 20일
편집: Matt J 2022년 5월 20일
I want to calculate the mean value of each matrix, with a for circle maybe, thus obtaining 300 vectors.
What do you mean 300 vectors? Wouldn't the mean over the entire matrix give you a scalar?

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2022년 5월 20일
편집: Matt J 2022년 5월 20일
S = structfun( @mean, load('yourFile.mat'),'uni',0);
matrix=cell2mat(struct2cell(S));

추가 답변 (1개)

Ilya Dikariev
Ilya Dikariev 2022년 5월 20일
singleMatrix=zeros(size(oldMatrix));
for i=1:length(singleMatrix)
singlematrix=mean(oldMatrix);
end
that should work if you want your end matrix in a single row

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by