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

7 次查看(过去 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};

请先登录,再进行评论。

采纳的回答

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