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

조회 수: 1 (최근 30일)
Jakub Matousek
Jakub Matousek 2017년 10월 28일
댓글: Jakub Matousek 2017년 10월 28일
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...

채택된 답변

KL
KL 2017년 10월 28일
you could use find,
c(find([c{:}]==2))={1};

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by