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!