Indexing through a cell array
Mostrar comentarios más antiguos
I am looking to populate cell array named 'age_list' based on the values i have in two columns; named 'day' and 'pop'
- For each specific 'day', i am looking at the corresponding 'pop' value and then update the 'age_list' based on it.
- Example: On day 4, the population is 3. Therefore the cell array 'age_list' will have 'three' values with the {2,3,4}.
Can anyone suggest me on how to perform this? Any help will be appreciated.

6 comentarios
David Hill
el 23 de Sept. de 2021
I have no idea how you are obtaining the values in age_list from day and pop. A better explanation is needed for me.
Hari krishnan
el 23 de Sept. de 2021
Jan
el 23 de Sept. de 2021
The question is not clear yet. The inputs are:
day = 1:7;
pop = [1,2,3,3,3,4,6];
How do you get the output age_list{6} = [1,1,2,5,6,7] ? Why is age_list{6} = [1,4,5,6] ?
Hari krishnan
el 23 de Sept. de 2021
Hari krishnan
el 23 de Sept. de 2021
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!