What does this syntax mean?

4 Ansichten (letzte 30 Tage)
Alberto
Alberto am 10 Jul. 2013
Can you explain to me what does it mean this syntax end-364:end? Thank you

Akzeptierte Antwort

Image Analyst
Image Analyst am 10 Jul. 2013
Bearbeitet: Image Analyst am 10 Jul. 2013
It looks like it would be inside an array and mean that it's taking the last 365 elements of the array. E.g.
last365elements = data(end-364:end);

Weitere Antworten (1)

Evan
Evan am 10 Jul. 2013
Bearbeitet: Evan am 10 Jul. 2013
You can index and array with end. End is basically just the length of your variable. So this is saying "index from the 365th from last to the last element of my array."
Example:
>>A = 1:10;
>>A(end-3:end)
ans =
7 8 9 10

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by