Help creating a 3D array

조회 수: 4 (최근 30일)
Jon Marks
Jon Marks 2015년 11월 18일
답변: Walter Roberson 2015년 11월 18일
I currently have 27 Matlab files that I have been able to load. Each Matlab file has a 2D x-velocity field that shows up as a 40x50 Matrix.
I am trying to create a 3D array so that I can find the average of each point (i.e. avg of all i1j1s's) for all 27 files.
So far, the last step i have done is
for n=1:27:
...............................
xData = load(filename,'x');
I tried doing A(:,:,n)=xData, but I am unsure how to average from that set of data.
**TO CLARIFY:
The issue I am having right now is that the A(:,:,n)=xData makes an array of 1x1x27. I want to create an array that is 40x50x27

채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 18일
fileData = load(filename,'x');
xData = fileData.x;
load() of a .mat file returns a structure with fields named after the variables loaded.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by