convert xi to i
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
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
Antworten (1)
madhan ravi
am 26 Jul. 2020
ix = ismember(cell_array, 'x1') % strcmp()
Wanted = ix + 2 * ~ix
4 Kommentare
madhan ravi
am 26 Jul. 2020
Wanted = str2double(regexprep(cell_array, '\D*', ''))
Parisa Keshavarz
am 26 Jul. 2020
Parisa Keshavarz
am 26 Jul. 2020
madhan ravi
am 26 Jul. 2020
That’s a new question and I don’t know how it’s related to this question.
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!