Mean and SD for 3D matrix
古いコメントを表示
Hello,
I have a 3D matrix (140 rows, 572 columns) for 91 cases which are safed in one .mat file. How can I create a new .mat file with the average Matrix and one for the SD Matrix? I have tried:
FileData = load('Matrix.mat');
Matrix_Avg = mean(3, Parameter);
But always get an error.
Help is much appreciated!
2 件のコメント
Rik
2021 年 2 月 17 日
From your other question I suspect you don't have a 3D array, but a struct array. Is that correct? Please attach your data or post code that creates similar data.
回答 (1 件)
The cat function is one of the few (if not the only) functions where the dimension input comes first. In most other functions (including both mean and std) it comes after the data.
A = randi(16, 4, 4);
B = magic(4);
C = cat(3, A, B) % Concatenate in dimension 3
D = mean(C, 3) % Take the mean along dimension 3
6 件のコメント
doehr001
2021 年 2 月 17 日
Rik
2021 年 2 月 17 日
Did you read what Steven wrote? The syntax for the mean function is not what you wrote, it should be mean(data,dim).
doehr001
2021 年 2 月 17 日
Steven Lord
2021 年 2 月 17 日
What is the full and exact text (everything displayed in red and/or orange) of the error/warning messages you received when you ran the following code?
Avg = mean(Matrix, 3);
doehr001
2021 年 2 月 17 日
Rik
2021 年 2 月 18 日
When posting an error message, please make sure to post all the red text. And please use the layout tools to format your code as code.
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!