How can I convert every floating value in cell to integer?
Afficher commentaires plus anciens
I have a cell with matrices of different sizes in it .I want to convert every floating value in cell to integer. I tried int16 function but apparently it can only be used for arrays..is there any function for cells?
Réponse acceptée
Plus de réponses (1)
Jos (10584)
le 3 Mar 2014
Two step approach for mixed cell arrays
C = {(1:10)/3, 'hello',[pi exp(1)]}
tf = cellfun(@isnumeric,C) % which cell are numeric?
C(tf) = cellfun (@(x) int16(x), C(tf),'un',0) % only convert those
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!