Comma-separated assignment to a table variable

The code below tests assignment by comma-separated expansion to a cell array in 3 different scenarios. In the specific case when the cell array X is the variable of a table, it fails. Why is that?
X=cell(1,3);
S.X=X;
T=table(X);

[X{:}]=deal(1,2,3) %Case (1) : works fine

[S.X{:}]=deal(1,2,3) %Case (2) : works fine

[T.X{:}]=deal(1,2,3) %Case (3) : failsThe code below tests assignment by comma-separated expansion to a cell array in 3 different scenarios. In the specific case when the cell array X is the variable of a table, it fails. Why is that?
X=cell(1,3);
S.X=X;
T=table(X);

[X{:}]=deal(1,2,3) %Case (1) : works fine

[S.X{:}]=deal(1,2,3) %Case (2) : works fine

[T.X{:}]=deal(1,2,3) %Case (3) : fails The code below tests assignment by comma-separated expansion to a cell array in 3 different scenarios. In the specific case when the cell array X is the variable of a table, it fails. Why is that?
X=cell(1,3);
S.X=X;
T=table(X);

[X{:}]=deal(1,2,3) %Case (1) : works fine

[S.X{:}]=deal(1,2,3) %Case (2) : works fine

[T.X{:}]=deal(1,2,3) %Case (3) : fails comma separated lists, assignment, table, csl MATLAB Answers — New Questions

​

Leave a Reply

Your email address will not be published. Required fields are marked *