How to carry out operations inside a cell with two 4D complex double inside it
83 views (last 30 days)
Show older comments
I have a cell of size 1X2. inside the cell there are two complex double (14X2X32X32), suppose a and b. I want to take mean of each 4D complex double. how to do this
0 Comments
Answers (1)
nick
on 10 Sep 2024 at 4:22
Hi Anusaya,
I understand that you want to compute the mean of the two complex double, each being a 14x2x32x32 vector.
You can compute the mean of the variables using the 'for' and the 'mean' functions. The 'mean' function returns the means of elements of A along the first dimension whose size is greater than 1. Here's a MATLAB script that demonstrates how to compute mean of the given variables :
% Assume 'dataCell' is your cell array containing the two 4D complex arrays
dataCell = {rand(14, 2, 32, 32) + 1i*rand(14, 2, 32, 32), rand(14, 2, 32, 32) + 1i*rand(14, 2, 32, 32)};
means = cell(1, 2);
% Loop over each element in the cell array
for idx = 1:numel(dataCell)
% Extract the current 4D complex array
complexArray = dataCell{idx};
% Compute the mean over all elements
means{idx} = mean(complexArray(:));
end
% Display the means
disp('Means of each 4D complex array:');
disp(means);
You can refer to the following documentation to learn more about the 'mean' function:
Hope this helps.
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!