Borrar filtros
Borrar filtros

How to convert the present data into another format?

1 visualización (últimos 30 días)
Bhavnish
Bhavnish el 24 de Sept. de 2014
Comentada: Bhavnish el 26 de Sept. de 2014
I have data in the following format. temp = a: [1x315 double] b: [1x315 double] c: [1x315 double] d: [1x315 double] e: [1x315 double] f: [1x315 double]
I need to convert this data into following format: temp = data: [315x6 double] var: {'a' 'b' 'c' 'd' 'e' 'f'} Please suggest how should I do this conversion.

Respuesta aceptada

Roger Wohlwend
Roger Wohlwend el 25 de Sept. de 2014
temp = [a; b; c; d; e; f]';
  6 comentarios
Joseph Cheng
Joseph Cheng el 25 de Sept. de 2014
which in this case would be fine. I usually read all entries to an accepted question as sometimes people comeback with different methodologies. But yes in general somehow people are confused with posting here. (the {}code button is a prime example)
Bhavnish
Bhavnish el 26 de Sept. de 2014
Roger, Joseph, if we combine the answer from both of you, then data conversion that I was looking for happens succesfully.
However, mathworks doesn't allow me to combine and accept the answer. Once, I clicked on the Accepted answer of Roger, it didn't aloow me to do anything else. I am sorry to create the confusion here.

Iniciar sesión para comentar.

Más respuestas (1)

Joseph Cheng
Joseph Cheng el 25 de Sept. de 2014
to expand on Roger's answer you you can build the structure like this
a = randi(10,1,351);
b = randi(10,1,351);
c = randi(10,1,351);
d = randi(10,1,351);
e = randi(10,1,351);
f = randi(10,1,351);
temp.data = [a; b;c;d;e;f]';
temp.var = {'a' 'b' 'c' 'd' 'e' 'f'};
  1 comentario
Bhavnish
Bhavnish el 25 de Sept. de 2014
Hey Joseph, This works well.
Thanks a lot Joseph and Roger.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by