Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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

Réponses (1)

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

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by