'Conversion to cell from double is not possible.' During table assignement

조회 수: 5 (최근 30일)
Hello,
I have encountered this problem in one of my codes (reproduced here with simple data) :
vect = [1 2 4 3]; % creating a vector
mat = [vect;vect]; % juste a simple matrix
% initialising a table
varnames = {'SomeTableCellData'};
vartypes = {'cell'};
Table = table('Size',[0 length(varnames)],'VariableTypes',vartypes,'VariableNames',varnames);
% this works
Table(1,'SomeTableCellData') = {mat};
% this doesn't work
Table(2,'SomeTableCellData') = {vect};
But both {mat} and {vect} are cell arrays containing double, so I'm a bit lost as why this happens.
Thanks for your help.
  댓글 수: 2
Stephan
Stephan 2020년 11월 25일
편집: Stephan 2020년 11월 25일
Does work with a column vector:
vect = [1 2 4 3]'; % creating a vector and transpose it
mat = [vect, vect]; % juste a simple matrix
% initialising a table
varnames = {'SomeTableCellData'};
vartypes = {'cell'};
Table = table('Size',[0 length(varnames)],'VariableTypes',vartypes,'VariableNames',varnames);
% this works
Table(1,'SomeTableCellData') = {mat};
% this doesn't work
Table(2,'SomeTableCellData') = {vect};
Valentin LAPLAUD
Valentin LAPLAUD 2020년 11월 25일
Interesting... Didn't thought of that, thanks.
Still is a strange error though

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

채택된 답변

Raunak Gupta
Raunak Gupta 2020년 12월 4일
Hi,
I have brought this issue (with the row vector while assignment to a table) to the notice of our developers. They will investigate the matter further.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by