Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Need help with importing database with text field in Regressiontree

1 ビュー (過去 30 日間)
mohamed mizan
mohamed mizan 2014 年 8 月 20 日
終了済み: MATLAB Answer Bot 2021 年 8 月 20 日
i have database car and i have field michenicname and location how can i use carname ?
I have tried X=[michenicname location Horsepower Weight]
load carsmall % contains Horsepower, Weight, MPG X = [Horsepower Weight]; rtree = fitrtree(X,MPG)

回答 (1 件)

Tom Lane
Tom Lane 2014 年 8 月 23 日
You don't say what your data looks like and what problem you are having.
I'm guessing the michenicname variable is text and that's why you're having a problem. You can't concatenate that with numeric variables. Your best bet may be to code the unique string values as group numbers. The grp2idx function may be helpful.

Community Treasure Hunt

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

Start Hunting!

Translated by