Conversion to cell from double is not possible

조회 수: 148 (최근 30일)
Tolulope Abiola
Tolulope Abiola 2019년 8월 16일
댓글: Daniele De Gregorio 2023년 7월 19일
I am trying to do some column calculations in MATLAB Gui columns. Like 2*pi*column1 gives column 3... So I used the code
dataC = get(handles.uitable1, 'Data'); dataC(:,3) = cell2mat(dataC(:,1)) * pi * 2;
Ans this gives error of conversion to cell from double is not possible in reference to the last line of the code.

채택된 답변

Stephen23
Stephen23 2019년 8월 16일
편집: Stephen23 2019년 8월 16일
A = cell2mat(dataC(:,1));
B = A * pi * 2;
dataC(:,3) = num2cell(B); % <- you need NUM2CELL!
  댓글 수: 6
Stephen23
Stephen23 2019년 8월 25일
@Tolulope Abiola: either make sure that the uitable column is numeric, or convert to numeric after obtaining the data from the uitable.
Daniele De Gregorio
Daniele De Gregorio 2023년 7월 19일
nice!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by