Borrar filtros
Borrar filtros

How to fill an array with Nans from 11,000x43 to 32,000x43 to generate a 3D array to be able to concatenate?

1 visualización (últimos 30 días)
I'm trying to generate a 3D array with 100 different files, however when it tries to concatenate it can't because there are 30 11,000 x 43 files and 70 32,000 x 43 files. I'd like to be able to make them the same size so I can concatenate them.
In addition, I attach a file of each one as an example of the dimensions.
This is my example:
close all; clear all
P = 'D:\2021\datos_cozumel\DatosADCP2\';
S = dir(fullfile(P,'S1*.mat'));
S = natsortfiles(S);
for k = 1:numel(S)
F = fullfile(P,S(k).name);
L = load(F);
v1(k).data = L.Data.Burst_VelBeam1;
end
vb1 = permute(cat(3,v1.data),[1,3,2]);
save('velbeam1_3.mat','vb1')

Respuestas (1)

Walter Roberson
Walter Roberson el 4 de Ag. de 2022
heights = structfun(@(V)size(V.data,1), v1);
maxheight = max(heights);
paddings = maxheights - heights;
for K = 1 : numel(S)
v1(k).data = [v1(k).data; nan(paddings(K),43)];
end
vb1 = permute(cat(3,v1.data),[1,3,2]);

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by