How to reconstruct a 3D matrix from a vector?
Show older comments
I have a 3D matrix A1 filled with numbers. I accessed a specific element across all the sheets to filter it. I need to do this for all the elements and create a new 3D matrix A2 of the same dimensions as A1. This is the code I’ve got so far after referring to https://in.mathworks.com/matlabcentral/answers/15463-how-to-create-a-3d-matrix-using-the-2d-matrices. The problem is that now I get the same numbers on all the sheets for A2.
The code is like this
%A1 is a 5x10x7 matrix
C1=randi(1,5,10);A2=zeros(5,10,7);
for i=1:5
for j=1:10
T2 = reshape(A1(i,j,:), [],1);
k=smoothdata(T2,'movmean');
A2(i,j,:)=k(A1(i,j));
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation 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!