Use Matrix(Matrix == x) = y; on cell aray

1 vue (au cours des 30 derniers jours)
Jakub Matousek
Jakub Matousek le 28 Oct 2017
Commenté : Jakub Matousek le 28 Oct 2017
Hello, is there a way to use some sort of this cellarray{:}(cellarray{:} == 2) = [1 1 1]; for cell array of ints? Cant really find it anywhere. Don't want to use any for loops into switch statements...

Réponse acceptée

KL
KL le 28 Oct 2017
you could use find,
c(find([c{:}]==2))={1};

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices 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!

Translated by