Add SINGLE element to array or vector
Ältere Kommentare anzeigen
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 Kommentar
Image Analyst
am 27 Mai 2022
@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.
Akzeptierte Antwort
Weitere Antworten (2)
Dakota Jandek
am 7 Apr. 2020
2 Stimmen
x = [1, 2, 3]
x(length(x)+1) = 4
2 Kommentare
Adrien Bouguerra
am 18 Okt. 2020
amazing method , really efficient thank u so much Dakota
Image Analyst
am 18 Okt. 2020
Or even better,
x = [1, 2, 3]
x(end+1) = 4
Youssef AAKAM
am 13 Okt. 2019
1 Stimme
x=[]
x=[x;'ysf']
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!