How to make specific elements of a cell equal to zero?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Haitham AL Satai
le 15 Sep 2022
Réponse apportée : Walter Roberson
le 15 Sep 2022
I have a cell 41 * 41 dimension and I would like to make the values that over 0.5 zeros and the rest of the values keep them without any changes.
Any assistance, please?
0 commentaires
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 15 Sep 2022
newCell = cellfun(@(M) M.*(M<=0.5), YourCell, 'uniform', 0)
However this will fail in locations that contain infinite values.
0 commentaires
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT-Files 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!