Borrar filtros
Borrar filtros

How can I combine multiple cell arrays and double arrays into a specific format that I need?

2 visualizaciones (últimos 30 días)
Hi, this might be a very simple problem but I am stuck.
I have two 5x1 cell arrays and one 5x1 double array. I need to combine them into a 5x3 cell array. Somehow I am getting stuck into converting the data into the format that I need. Let me explain using an example:
vStrNames1 = {'a';'b';'c';'d';'e'}
vStrNames2 = {'v';'w';'x';'y';'z'}
vDblNumbers = [1;2;3;4;5]
When I try to combine these by using:
test = {vStrNames, vStrNames2, vDblNumbers}
I get the following result:
test =
{5x1 cell} {5x1 cell} [5x1 double]
But ultimately I need to create the following:
test =
'a' 'v' [1]
'b' 'w' [2]
'c' 'x' [3]
'd' 'y' [4]
'e' 'z' [5]
How can I achieve this? Thanks for any hint Sven

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 24 de Jul. de 2014
vStrNames1 = {'a';'b';'c';'d';'e'}
vStrNames2 = {'v';'w';'x';'y';'z'}
vDblNumbers = [1;2;3;4;5]
test = [vStrNames1,vStrNames2, num2cell(vDblNumbers)]

Categorías

Más información sobre Data Types 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