Merge columns with different cell input
2 views (last 30 days)
Show older comments
Hello,
How can I merge two columns where cells have different information?
Specifically I would like to merge the last two columns (lets call them F and G) into column H. In the example below F consists of a 1x5 table whereas G is ''. I have multiple tables like this, where F and G have the following information:
- either F Table and G '' (shortened example below)
- or G Table and F ''
- or both Table
In case of 3., I would like to merge the two in a long format., such that each row is double.
'floor_csv' '5610002' 'Male' 12.8300000000000 16.2200000000000 1x5 table ''
'floor_csv' '5610004' 'Female' 47.8300000000000 28.5500000000000 1x5 table ''
'floor_csv' '5610005' 'Female' 13.7500000000000 16.1400000000000 1x5 table ''
...
I only came up with H = [F; G], which did not work.
Any help is appreciated!
0 Comments
Answers (1)
Duncan Po
on 9 Jun 2021
Can you convert your empty char '' into empty array []? Tables can be concatenated with empty array but not empty char:
t = table([1; 2]); c = ''; a = [];
[t c]
All input arguments must be tables.
[t a]
ans =
2×1 table
Var1
____
1
2
1 Comment
See Also
Categories
Find more on Tables 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!