Add SINGLE element to array or vector
古いコメントを表示
I have a vector of the format:
x = [xval(1) xval(2) … xval(n)]
, and I want to add an element to the end, xval(n+1). How do I do that?
1 件のコメント
Image Analyst
2022 年 5 月 27 日
@Anushalini Thiyagarajan I have no idea what you mean. Please ask your question in a new question (not here) after you read this:
In the meantime, look at input functions such as readmatrix, importdata, dlmread, xlsread, fgetl, etc.
採用された回答
その他の回答 (2 件)
Dakota Jandek
2020 年 4 月 7 日
2 投票
x = [1, 2, 3]
x(length(x)+1) = 4
2 件のコメント
Adrien Bouguerra
2020 年 10 月 18 日
amazing method , really efficient thank u so much Dakota
Image Analyst
2020 年 10 月 18 日
Or even better,
x = [1, 2, 3]
x(end+1) = 4
Youssef AAKAM
2019 年 10 月 13 日
1 投票
x=[]
x=[x;'ysf']
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!