Divide array in to smaller 3D array

조회 수: 3 (최근 30일)
Mantas Vaitonis
Mantas Vaitonis 2018년 7월 28일
댓글: Mantas Vaitonis 2018년 7월 28일
Hello, Maybe someone could help me with the following situation. Lets say I have multiple *.mat files, that contains of arrays with different number of rows but with the same number of columns. I need to divide each loaded array in to smaller 3D arrays. For example if I have array a 1324000xM, I would like to make 400000xMx3, and 124000 rows would be used for training later. If I have array 2411000xM it should be 400000xMx6. And not always it would be 400000 rows it could warry, what would be the way to achieve this?
  댓글 수: 2
Image Analyst
Image Analyst 2018년 7월 28일
I don't understand how your .mat files, that contains one or more arrays (I'm not sure if it's one or more than one), are 3-D. And when you make your 3-D arrays, like a 400000xMx3 starting with a 1324000xM, what goes into the 3rd dimension? And how do you know if the 3rd dimension will be 3 or 6 planes? Have you tried reshape() and permute()?
Mantas Vaitonis
Mantas Vaitonis 2018년 7월 28일
There is multiple number *.mat files and each contains 2d array. Regarding third dimension and how I know if there will be 3 I take 1324000/400000=3,085 and integer number is 3. I need to convert 2D array in to smaller 2D arrays, however in order to make easier to access data I place these smaller 2D arrays in one 3D array. As example 2d array a 1324000xM then 3D x would look like this:
x(:,:,1)=test(1:400000,:);
x(:,:,2)=test(400001:800000,:);
x(:,:,3)=test(800001:1200000,:);
But all 2D arrays are different size, thus would like to know if it could be achieved using clever functions. Reshape would not work because the number of elements must not change and regarding permute not sore how it would work as the size of all arrays are different.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by