basic code question
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Hello,
If I had two vectors x1 and x2. How could I make vector x3 with all the elements of x2 except the first 3 elements and last 3 elements are from x1?
Many thanks
John
1 件のコメント
Oleg Komarov
2012 年 3 月 22 日
Please give a specific title to your questions. Otherwise it's hard to tell wether you're double-posting or not.
回答 (3 件)
Thomas
2012 年 3 月 22 日
Is this what you wanted?
x1=1:10
x2=11:20
y=[x2(3:length(x2)) x1(1:length(x1-3))]
5 件のコメント
John
2012 年 3 月 22 日
Thomas
2012 年 3 月 22 日
y=[x1(1:3) x2(4:7) x1(8:10)]
Wayne King
2012 年 3 月 22 日
x3 = [x1(1:3) x2(4:end-3) x1(end-2:end)];
John
2012 年 3 月 22 日
Oleg Komarov
2012 年 3 月 23 日
Concatenate vertically as I show in my example.
Oleg Komarov
2012 年 3 月 22 日
If same size:
x1(4:end-2) = x2(4:end-2);
Otherwise:
[x1(1:3); x2(4:end-2); x1(end-2:end)]
0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!