replace [ ] in an array with 0's
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
alpedhuez
le 7 Juil 2020
Modifié(e) : alpedhuez
le 7 Juil 2020
talks about replace [] with 0's for one column. But suppose I have a table with many columns and I want to run this operation for multiple colmns. Is there any way simpler than writing another loop?
0 commentaires
Réponse acceptée
Image Analyst
le 7 Juil 2020
tables use functions like ismissing() and fillmissing():
newTable = fillmissing(badTable, 'constant', 0)
1 commentaire
Plus de réponses (2)
KSSV
le 7 Juil 2020
You can get all the emtpy functions in a cell using cellfun ..
idx = cellfun(@isempty,C) ; % get empty cells in a cell array C
C(idx) = 0 ; % replace with zero
Note that, cellfun also uses loop inside.
1 commentaire
Voir également
Catégories
En savoir plus sur Logical 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!