Subtracts Two Cell Arrays to Yield a Third Array

조회 수: 2 (최근 30일)
Maskus Kit
Maskus Kit 2021년 4월 5일
댓글: Maskus Kit 2021년 4월 5일
Hello friends,
I've got two cell arrays of equal size. How do I go about subtracting them to create a third cell array ouput?
Thanks.

채택된 답변

KSSV
KSSV 2021년 4월 5일
편집: KSSV 2021년 4월 5일
Let C1 and C2 be two cell arrays of equal size and having same data each cell.
N = length(C1) ;
iwant = cell(N,1) ;
for i = 1:N
iwant{i} = C1{i} - C2{i} ;
end
Or use cellfun
iwant = cellfun(@minus,C1,C2,'UniformOutput',false) ;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by