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

1 Ansicht (letzte 30 Tage)
Jakub Matousek
Jakub Matousek am 28 Okt. 2017
Kommentiert: Jakub Matousek am 28 Okt. 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...

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by