Merge 2 columns with strings

1 view (last 30 days)
Hello,
I have been trying to look if someone else had a similar question. But not sucess so I want to ask. How would you approach merging two columns with strings as the picture below? Thanks in advance
  1 Comment
Dyuman Joshi
Dyuman Joshi on 16 Jun 2022
How is your data imported in MATLAB? This looks like Excel.

Sign in to comment.

Accepted Answer

Carson Purnell
Carson Purnell on 16 Jun 2022
Edited: Carson Purnell on 16 Jun 2022
given column 1==A and column 2==B, this stacks those columns without sorting.
%example arrays
A = {'a',1;'b',2}; B = {'c',11;'n',12};
vertcat(A,B)
Pretty simple. But it is unclear what your data is, how it is organized, or what your specific intent is. Please provide more details.
  6 Comments
Alexander Guillen
Alexander Guillen on 16 Jun 2022
I have seen like two other people ask this question, and they dont get any answer. I will keep trying - it is nothing crucial- it is just to save me time.
Carson Purnell
Carson Purnell on 16 Jun 2022
Edited: Carson Purnell on 16 Jun 2022
You don't need to keep trying, if you read my comment I have provided the code to do it. Just inches upward on the screen. Make sure to read the documentation on vertcat.

Sign in to comment.

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!