필터 지우기
필터 지우기

How to change CELL components value?

조회 수: 42 (최근 30일)
Steven
Steven 2013년 12월 28일
답변: Wayne King 2013년 12월 28일
How can we change the values of a cell component? I mean for example, A{i}.
For example when I want to divide all the values of a cell by 2, the usual math doesn't work:
A{i}=A{:}/2
or A=A/2
none of them works.
what shall I do?
thanks
Steven

채택된 답변

Wayne King
Wayne King 2013년 12월 28일
A = cell(2,1);
A{1} = randn(100,1);
A{2} = randn(100,1);
A{1} = A{1}/2;
A{2} = A{2}/2;
Or if you want to do it to all the elements in the cell array
out = cellfun(@(x) x/2,A,'uni',0);

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by