convert xi to i
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Hello,
I have created a regression tree and I have printed the cut predictors which are the variables that were used in each branch.
It gives me a cell array like this: 'x2' 'x1' 'x1'
I need these to be converted into numerical values. Instead of 'x2' I need 2 or instead of 'x1' I need 1
How should I do this conversion?
Thank you
0 件のコメント
回答 (1 件)
madhan ravi
2020 年 7 月 26 日
ix = ismember(cell_array, 'x1') % strcmp()
Wanted = ix + 2 * ~ix
4 件のコメント
madhan ravi
2020 年 7 月 26 日
Wanted = str2double(regexprep(cell_array, '\D*', ''))
Parisa Keshavarz
2020 年 7 月 26 日
Parisa Keshavarz
2020 年 7 月 26 日
madhan ravi
2020 年 7 月 26 日
That’s a new question and I don’t know how it’s related to this question.
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!