Add n+1 element to a vector
4 ビュー (過去 30 日間)
古いコメントを表示
I have a vector of the format:
x = [X1 X2 … Xn]
I want to add an element to the end, X(n+1). How do I do that?
ex: x = [ 1 4 2 8]
newX = [ 1 4 2 8 9]
0 件のコメント
採用された回答
Peng Li
2020 年 4 月 10 日
If your X is a row vector, using newX = [X, aNewElement];
If your X is a column vector, using newX = [X; aNewElement];
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Automated Driving Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!