Why will categorical not convert this cell string?

13 ビュー (過去 30 日間)
Poison Idea fan
Poison Idea fan 2023 年 1 月 24 日
コメント済み: Poison Idea fan 2023 年 1 月 24 日
What is the difference between these two lines?
The first line works correctly. The second line is giving an error.
Caused by:
Error using cell
Conversion to cell from categorical is not possible.
It seems to be working in here.
piedmont_1025.BurnCondition(:,1) = categorical({'Wild'});
piedmont_1025.FuelType(:,1) = categorical({'Piedmont'});
  1 件のコメント
Poison Idea fan
Poison Idea fan 2023 年 1 月 24 日
Restarting matlab got rid of the issue though I am not sure what caused it.

サインインしてコメントする。

採用された回答

Sean de Wolski
Sean de Wolski 2023 年 1 月 24 日
編集済み: Sean de Wolski 2023 年 1 月 24 日
The left-hand side was a cell. So it successfully converted the right-hand side to categorical but then could not stick the categorical in as a cell on the left hand side.
c = cell(2,1)
c = 2×1 cell array
{0×0 double} {0×0 double}
c(1,1) = categorical({'hello'})
Unable to perform assignment because value of type 'categorical' is not convertible to 'cell'.

Caused by:
Error using cell
Conversion to cell from categorical is not possible.
  1 件のコメント
Poison Idea fan
Poison Idea fan 2023 年 1 月 24 日
I see. Thanks for clarifying.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCategorical Arrays についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by