Hi, I'm new to matlab. I was just wondering how I list the last 10 names in the human activity data set where it says actnames?

2 visualizaciones (últimos 30 días)
So when you write load humanactivity and press enter. Then write whos, it shows a few names such as featlabels, actnames and so on. For the act names how do i list the last 10 activites based on that.

Respuestas (1)

Dillon
Dillon el 23 de Abr. de 2025
You can use the "end" keyword to access the last element of an array. Using "end - 10" will access 10 elements from the last element. Additionally, the ":" operator returns an array of first number to the second with default iterations of 1. You can use disp() to display :)
x = 1:20;
indexing = x(end-10:end)
indexing = 1×11
10 11 12 13 14 15 16 17 18 19 20
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by