MATLAB Answers

0

Warning: The assignment added rows to the table, but did not assign values to all of the table's existing variables. Those variables will extended with rows containing default values.

Zeynab Mousavikhamene さんによって質問されました 2019 年 10 月 20 日
最新アクティビティ dpb
さんによって 回答されました 2019 年 10 月 20 日
dpb
さんの 回答が採用されました
Why do I recieve this warning?

  0 件のコメント

サインイン to comment.

タグ

1 件の回答

回答者: dpb
2019 年 10 月 20 日
 採用された回答

Apparently you had a table with N variables but only assigned values to a subset of those when adding rows.
Example:
>> x=rand(3,1);y=rand(3,1); % some dummy data
>> t=table(x,y) % turn into table
t =
3×2 table
x y
________ _______
0.021833 0.20422
0.3931 0.66228
0.25254 0.91474
>> t.y(4)=0.5; % add a y row, but forget about x
Warning: The assignment added rows to the table, but did not assign values to all of the
table's existing variables. Those variables have been extended with rows containing default
values.
> In tabular/subsasgnDot (line 457)
In tabular/subsasgn (line 67)
>> t % so what did it do???
t =
4×2 table
x y
________ _______
0.021833 0.20422
0.3931 0.66228
0.25254 0.91474
0 0.5
>>
As shown, it added the y value as asked, but filled in a zero (default value) for x.
Always add for every variable (even if want the default value) to avoid the warning. You could disable the warning if doing this deliberately, but I really wouldn't recommend that over explicit assignment.

  0 件のコメント

サインイン to comment.



Translated by