cell with not consistent dimensions to double

조회 수: 1 (최근 30일)
Frederik Reese
Frederik Reese 2022년 6월 24일
댓글: Jon 2022년 6월 24일
Hi,
probably a simple Question:
I have the attached cell and want the values in a double or table.
For rows of the cell with more than one value I want the max of this cell row.
Thanks in advance.

채택된 답변

Jon
Jon 2022년 6월 24일
편집: Jon 2022년 6월 24일
X = cell2mat(cellfun(@max,Zeit_Flutende_10000_BA,'UniformOutput',false))
Note that you have at least one empty entry, for example, the third row of your cell array. This will be deleted from the output, so you output array of doubles will have less rows than your original cell.
Also if you just remove that empty row everything gets much simpler because we don't have to keep a cell entry for the empty result and we can use the max function to directly get a matrix of doubles, so for example:
Zeit_Flutende_10000_BA(3) = []; % remove the third row
Zeit_Flutende_10000_BA = cellfun(@max,Zeit_Flutende_10000_BA)
  댓글 수: 2
Frederik Reese
Frederik Reese 2022년 6월 24일
thanks a lot
Jon
Jon 2022년 6월 24일
Your welcome

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by