How to decompose 3d array to 3 matrices

5 visualizaciones (últimos 30 días)
RADWAN A F ZEYADI
RADWAN A F ZEYADI el 25 de Oct. de 2021
Editada: James Tursa el 25 de Oct. de 2021
Hi every one
i have a 3d array with dimension 51*71*3 and i want to obtain column vector 153*1
d=(51*71*3)
n=d(:,:,1) so now 51*71
r=d(:,:,2) becomes 51*71
c=data(:,3) becomes51*71
so now b=[n;r;c] 153*71
but i need153*1 instead
how can i obtain this vector
thanks in advance

Respuestas (1)

Jan
Jan el 25 de Oct. de 2021
x = rand(51, 71, 3);
v = reshape(x(:, 27, :), [], 1);
size(v)
ans = 1×2
153 1
  2 comentarios
RADWAN A F ZEYADI
RADWAN A F ZEYADI el 25 de Oct. de 2021
thanks but i mean 153 *1 of original d (153*71) i dont need to generate random vector
James Tursa
James Tursa el 25 de Oct. de 2021
Editada: James Tursa el 25 de Oct. de 2021
@RADWAN A F ZEYADI The random vector was just to generate sample data of the same size as your problem. Jan is not suggesting that you need to use rand( ) in your code. E.g., using your d variable:
v = reshape(d(:, 27, :), [], 1);

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by