cellをcategaricalに変更する方法
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/840240/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/840245/image.png)
質問失礼いたします。
左の画像にあるように1行1列のラベルだけを、右の画像の1行1列のラベルに変換させたいのですが、
単純に下記のようなコードを実行すると、エラーが発生してしまいます。
labels{1,1} = label{1,1};
非セル配列オブジェクトにセル要素を代入しています。
cell配列をcategoricalに変換させてから代入したいのですが、どのように対処すればわかりません。
ご回答よろしくお願いいたします。
0 commentaires
Réponse acceptée
Kojiro Saito
le 22 Déc 2021
「非セル配列オブジェクトにセル要素を代入しています。」のエラーは、labels{1,1}のところで起きています。
中括弧{}で要素にアクセスするのはセル配列だけできるのですが、labelsは2x1のcategorical配列で、セルにはなっていません。labels{}をlabels()と小括弧に変えるだけでやりたいことが実現できます。
labels(1,1) = label{1,1};
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!