フィルターのクリア

calculating mean values of a 3D matrix

119 ビュー (過去 30 日間)
noa
noa 2012 年 10 月 9 日
コメント済み: ankit patel 2020 年 4 月 11 日
hi.
I have a 3D matrix. size 79x63x100
I want to calc the mean of each of the 79x63 values so to get a 2D matrix the size of 79x63x1
but when i do mean(mat) i get it in the size of 1x63x100
how should I write it?
Thanks, Noa
  2 件のコメント
Deepak Singh
Deepak Singh 2015 年 7 月 15 日
You can mention the dimension you want to take mean across. Something like this will work: x=mean(mat,3);
ankit patel
ankit patel 2020 年 4 月 11 日
its not working if i change the value 3 with more than 3 in your equation.

サインインしてコメントする。

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 10 月 9 日
out = mean(yourarray3D,3)
  5 件のコメント
Akshay Bhardwaj
Akshay Bhardwaj 2018 年 5 月 24 日
編集済み: Akshay Bhardwaj 2018 年 5 月 24 日
out = std(yourarray3d,[],3)
BBB
BBB 2019 年 11 月 13 日
Hi,
I also have a similar question.
I have a 51x51 2D matrix that I need to take a mean off, but it has to give me back a 51x51 2D matrix as an output.
How can do this using the mean function. I need to put this in a loop as well. Please see code below for reference:
rand_image_stim = rand(10000,51,51);
kk = 1:length(rand_image_stim);
firing_rate_kk(kk) = 0;
gab_filt = z_cos.*z_gauss;
lp(kk) = 0;
for kk = 1:length(rand_image_stim)
output_kk = squeeze(rand_image_stim(kk,:,:)).*gab_filt;
firing_rate_kk(kk) = sum(output_kk,'all');
jk = squeeze(rand_image_stim(kk,:,:))*firing_rate_kk(kk);
lp = squeeze(mean(jk,2)); %Need help with this last bit!
end

サインインしてコメントする。

その他の回答 (1 件)

Zoe
Zoe 2017 年 11 月 28 日
shape2 = reshape(yourarray,[100 79*64]);
meanArray = mean(shape2,2);

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by