필터 지우기
필터 지우기

Conversion to cell from double is not possible

조회 수: 1 (최근 30일)
Stephen Thompson
Stephen Thompson 2018년 5월 22일
답변: OCDER 2018년 5월 22일
I don't understand why I am getting this error.
1. This works...
onset_time_first = cell(ratio_channels,4);
onset_time_first (:, 1) = cellfun(@(x,y,z)(cusum(x, climit, mshift, y, z)), beta_cell(:, 1), beta_cell (:, 2), beta_cell (:, 3), 'UniformOutput', false);
Here beta_cell is a 189x3 cell. This is repeated 3 more times.
2. This does not work...
onset_time_second = cell(ratio_channels,4);
onset_time_second (:, 1) = cellfun(@(x)(findchangepts(x, 'Statistic', 'mean')), beta_cell_second);
Here beta_cell_second is a 189x1 cell. This is repeated 3 more times.
The syntax is identical but the first works and the second doesn't. It doesn't help to add "beta_cell_second(:))"

채택된 답변

OCDER
OCDER 2018년 5월 22일
If you want the output to be a cell in the case 2, you have to do this
onset_time_second = cell(ratio_channels,4);
onset_time_second (:, 1) = cellfun(@(x)(findchangepts(x, 'Statistic', 'mean')), beta_cell_second, 'UniformOutput', false)
To help you understand, try this:
A = num2cell(1:10);
O = cell(1, 10);
B = cellfun(@(x) x(1), A); %Returns double matrix
C = cellfun(@(x) x(1), A, 'un', 0); %Returns cell array
O(:) = B; %ERROR! Conversion to cell from double is not possible
O(:) = C; %OKAY!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by