How can I extract the values form the cell array?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ali Mahdi
el 10 de Oct. de 2021
I have a cell array as follow:
[{'name': 'Monday', 'data': [0, 0, 0, 0, 0, 0, 0, 0, 44, 56, 58, 57, 62, 71, 73, 64, 47, 29, 0, 0, 0, 0, 0, 0]}, {'name': 'Tuesday', 'data': [0, 0, 0, 0, 0, 0, 0, 0, 60, 66, 61, 81, 91, 85, 67, 45, 0, 0, 0, 0, 0, 0, 0, 0]}, {'name': 'Wednesday', 'data': [0, 0, 0, 0, 0, 0, 0, 0, 60, 98, 84, 67, 72, 76, 69, 53, 0, 0, 0, 0, 0, 0, 0, 0]}, {'name': 'Thursday', 'data': [0, 0, 0, 0, 0, 0, 0, 0, 88, 82, 50, 43, 58, 69, 63, 44, 0, 0, 0, 0, 0, 0, 0, 0]}, {'name': 'Friday', 'data': [0, 0, 0, 0, 0, 0, 0, 0, 57, 90, 100, 90, 81, 74, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {'name': 'Saturday', 'data': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {'name': 'Sunday', 'data': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}]
Now i need to extract the values for each day in a able contain the day and its values as shown below;
Monday Tuesday ....
0 0
0 0
0 0
0 0
044 60
58 66
.... ....
Kindly suggest me if there is any function to deal with this.
Thank you in advances
0 comentarios
Respuesta aceptada
Chunru
el 10 de Oct. de 2021
Editada: Chunru
el 10 de Oct. de 2021
Obviously, you don't have a matlab cell array (is it a python array?). The matlab array may look like the following:
a(1).name='Monday';
a(1).data=[0, 0, 0, 0, 0, 0, 0, 0, 44, 56, 58, 57, 62, 71, 73, 64, 47, 29, 0, 0, 0, 0, 0, 0]';
a(2).name='Tuesday';
a(2).data =[0, 0, 0, 0, 0, 0, 0, 0, 60, 66, 61, 81, 91, 85, 67, 45, 0, 0, 0, 0, 0, 0, 0, 0]';
a(3).name='Wednesday';
a(3).data=[0, 0, 0, 0, 0, 0, 0, 0, 60, 98, 84, 67, 72, 76, 69, 53, 0, 0, 0, 0, 0, 0, 0, 0]';
% The same for the rest
[a.data]
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical 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!