[Scilab-users] concatenate hypermatrices along the 3rd dimension
Stéphane Mottelet
stephane.mottelet at utc.fr
Mon Oct 8 16:39:29 CEST 2018
Hello Antoine,
Why not write:
padded_b=zeros(2,2,9);
padded_b(:,:,4:6)=b;
?
S.
Le 08/10/2018 à 14:13, antoine.monmayrant at laas.fr a écrit :
> Hi all,
>
> I'm trying to stack (or concatenate) 3D matrices (hypermatrices) along
> the 3rd dimension.
> (The goal is to perform zero-padding along the 3rd dimension).
> So far, the only - and ugly - solution I've found is the following:
>
> //my padding
> a=zeros(2,2,3);
> //my data
> b=a;
> b(:,:,1)=[111,112;121,122];
> b(:,:,2)=[211,212;221,222];
> b(:,:,3)=[311,312;321,322];
> // zero-padded data
> padded_b=matrix([a(:);b(:);a(:)],[size(a,1),size(a,2),3*size(a,3)]);
> Is there a solution that is less convoluted (and maybe more efficient)
> than resorting to this mix of "(:)" and "matrix"?
>
> Thanks in advance,
>
> Antoine
>
> PS: If you are curious, I'm looking at the time evolution of a 2D
> image and need to do zero-padding and fft for spectral analysis : the
> 2 first dimensions are space ones (x,y), while the 3rd one is temporal
> evolution.
>
--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
More information about the users
mailing list