How to fix table variable related error?
Mostrar comentarios más antiguos
I am using the following matlab code
MdlReduced = fitrensemble(XX(:,{'td' 'ssr' 'tp'}),MPG,'Method','Bag', ...
'NumLearningCycles',200,'Learners',t);
But this is giving the following error
Error using ()
Unrecognized table variable name 'td'.
Please suggest me how to fix it?
Sanchit
2 comentarios
Saurabh Chaudhary
el 25 de Jul. de 2023
can you provide data for XX? Also look the documentation of fitrensemble.
Sanchit
el 25 de Jul. de 2023
Respuesta aceptada
Más respuestas (1)
Steven Lord
el 25 de Jul. de 2023
You expected for your table XX to contain a variable named td, but it doesn't. If you were trying to adapt another example to your needs perhaps the table in the example had that variable but yours does not. You can check if XX has that variable name:
listOfVariableNames = XX.Properties.VariableNames
Does listOfVariableNames contain 'td'?
ismember('td', listOfVariableNames)
Without seeing how you constructed XX it's difficult to offer concrete suggestions for how to solve the problem. If you read the data in from a file perhaps the file headers were not what you expected them to be? If you constructed that table variable using an expression [like td(:, 1)] instead of a plain variable name [like td] then the table variable would not be named using the variable name. Setting the variable name using renamevars could be an option in that scenario.
1 comentario
Sanchit
el 25 de Jul. de 2023
Categorías
Más información sobre Entering Commands en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!