How can I extract the values form the cell array?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Chunru
le 10 Oct 2021
Modifié(e) : Chunru
le 10 Oct 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Tables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!