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

1 visualizzazione (ultimi 30 giorni)
Jakub Matousek
Jakub Matousek il 28 Ott 2017
Commentato: Jakub Matousek il 28 Ott 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...

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by