How to aggregate two columns
显示 更早的评论
I want to combine two columns. Here is the example of probleme: A column has lot of number like 20100101;20100102... .B column has the same amount of numbers like 020510000;020510040... . I want to aggregate A and B columns to have one column like 2010010120510000;20100102020510040... . That every A(x) would be in the same row with B(x). Thank you very much.
采纳的回答
更多回答(1 个)
James Tursa
2015-9-17
编辑:James Tursa
2015-9-17
This is how one would do it if A and B are doubles:
C = A*1e8 + B;
However, each of A and B has 8 decimal digits, so the result of this calculation will have 16 decimal digits. That is right at the limit of what a double precision value can hold, and may even be beyond depending on the actual values involved. So this might not work and you may need a different method.
If A and B are actually char arrays, then it is simply:
C = [A,B];
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Compiler 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!