How do I turn two columns into one row?

2 vues (au cours des 30 derniers jours)
Sean Hiddleston
Sean Hiddleston le 21 Oct 2019
Commenté : Sean Hiddleston le 21 Oct 2019
My data looks like this:
a 1
b 2
c 3
d 4
etc.
I want it to look like this:
a 1 b 2 c 3 d 4
How do I get it into this format?
  4 commentaires
Sean Hiddleston
Sean Hiddleston le 21 Oct 2019
Hi Rik, thanks for your help. Unfortunately, I am very new to Matlab and I don't know how to do that. Here is what I'm looking at:Screen Shot 2019-10-21 at 23.37.29.png
If that's enough to work with, I would be very grateful. If you need more information than I'm able to provide right now, I completely understand.
Sean Hiddleston
Sean Hiddleston le 21 Oct 2019
I only want VarName5 and VarName7, the rest doesn't matter for now.

Connectez-vous pour commenter.

Réponse acceptée

David Hill
David Hill le 21 Oct 2019
If a cell array,
a={'a' 1;'b' 2;'c' 3;'d' 4};
b=a';
c=b(:)';%should give up the cell array in the format you desire
  1 commentaire
Sean Hiddleston
Sean Hiddleston le 21 Oct 2019
That worked perfectly, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by