save matrix in loop to 3D matrix (storage all inkomming matrix)

조회 수: 2 (최근 30일)
Nik Rocky
Nik Rocky 2020년 7월 3일
댓글: Nik Rocky 2020년 7월 4일
Hello,
I read multiple .mat-files with matrix M x-y-axis (5x2doubles) and have to save it. I think, the better way is to create a 3D-matrix - z-axis. Later, i have to make mean and std trow all z-axis elements. How can i do it?
Please think about - i get a matrix M in the loop, by load(MAT_File)
Thank you in advise!

채택된 답변

madhan ravi
madhan ravi 2020년 7월 3일
M = cell(n, 1); % n - number of files
for k = 1:n
M{k} = load(filenames{k}); % assuming you saved filenames in a cell array
end
M = cat(3, M{:});
MEAN = mean(M, 3)
  댓글 수: 4
Nik Rocky
Nik Rocky 2020년 7월 4일
Of course of this difference?
S = std(A,w,dim)
M = mean(A,dim)
Nik Rocky
Nik Rocky 2020년 7월 4일
MEAN = mean(M_test, 3);
STD = std(M_test,0, 3);
Success =)

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by