Could someone please help me create a three-column array?
Mostrar comentarios más antiguos
I have "NYC Diseases" data with the following 4 variables:
- chickenPox (41x12 double)
- measles (41x12 double)
- mumps (41x12 double)
- years (41x1 double)
The rows are the years, and the 12 columns are the 12 months. I am told to load the NYC diseases data sets (NYCDiseases.mat).
Create variable called diseases that holds a three-column array.
The first column is the monthly counts of measles, the second column is the monthly counts of mumps, and the third column is the monthly counts of chicken pox.
Could anyone help me on how I should approach this type of command? Would I be using the "reshape"?
Thank you. I'd really appreciate help on this.
1 comentario
Walter Roberson
el 11 de Abr. de 2016
You have not given us sufficient information about the correspondence between the 41x12 and "monthly counts". If we assume that the 12 corresponds to the 12 months of the year and each row corresponds to a year whose number is given in years then we still need to know whether the array is to have 41*12 rows or if it is to have 12 rows where the counts are total counts per month over all of the years.
Respuesta aceptada
Más respuestas (2)
Mariana
el 18 de Oct. de 2022
1 voto
For anyone here looking for this from 2022 and on, its:
diseases = [sum(measles,1).',sum(mumps,1).',sum(chickenPox,1).'];
Azzi Abdelmalek
el 11 de Abr. de 2016
0 votos
out=[measles(:),mumps(:),chickenPox(:)]
Categorías
Más información sobre Agriculture 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!