select only one value every four (or different numbers) in an array
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SYML2nd
el 29 de Nov. de 2021
Respondida: Chunru
el 29 de Nov. de 2021
Hi,
I would like to select only one value every four in an array. For instance, given an array [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16], I obtain
[4 8 12 16]. Are there simple commands to do this?
0 comentarios
Respuesta aceptada
Chunru
el 29 de Nov. de 2021
a = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]
b = a(4:4:16)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Multidimensional Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!