Merging two columns into one
7 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
Hope you are doing fine.
I have a questions, I have two columns lets call them E and F, they're of the same type (double) the size of E is 317760 by 1 and the size of F is 271776 by 1.
I know I can use vertcat to have them in one column E after F or vice versa but that's not what I want to do.
I have two other columns called Location1 and Location2, these columns are of the same size as E and F. What I want to do is merge E and F regarding location 1 and location 2.
For example: E = [10 20 30], F = [70 80 60] Location1 = [2 4 6] , Location 2= [ 1 3 5] I want my result to be E(according to location1) together with F(Location2) so: C = [70 10 80 20 60 30]. Even though Location1 and 2 here are alternating my actual data don't alternate.
If any clarification is needed please let me know,
Any ideas on how to do this would be great!
Thank You.
0 件のコメント
採用された回答
michio
2017 年 9 月 21 日
E = [10 20 30];
F = [70 80 60];
Location1= [2 4 6];
Location2= [1 3 5];
EF = zeros(1,6);
EF(Location1) = E;
EF(Location2) = F;
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!