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!