How can I return the last value of a vector?
Show older comments
Dear all,
is there a command in Matlab, which returns the last value of a vector? In R is this command called "tail". For example: X = [1, 2, 3, 4] and I need a command which returns the last value. Like tail(X) = 4. Thank you in advance!
1 Comment
Stephen Gerdts
on 17 Feb 2016
X(end)
Accepted Answer
More Answers (1)
Ehsan R
on 18 Apr 2013
0 votes
X = [1, 2, 3, 4]
X(end)
ans>>4 ****************************************
X=[1 2 3 4 5 6;7 8 9 10 11 12;13 14 15 16 17 18];
X= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
A(3,6:end)
ans>>18
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!