Error Troubleshooting Classification Models
Mostrar comentarios más antiguos
Im getting this error when i run my code

This is the code i am running
data = readmatrix('project.xlsx')
Tbl = array2table(data);
varNames = ["Number","Amplitude","PSD","Recurrence_Rate","Recurrance_Points","Determinism","Ratio_Determinism_Recurrence_Rate","Average_Diagonal_Length","Average_Vertical_Length","Laminarity","Divergence","Entropy","Trapping_Time","OSA_Label"];
mdl = fitcdiscr(Tbl, Number)
Please help troubleshoot this
Respuestas (1)
Kevin Holly
el 25 de Abr. de 2023
Editada: Kevin Holly
el 25 de Abr. de 2023
I believe you meant this:
mdl = fitcdiscr(Tbl, "Number")
instead of
mdl = fitcdiscr(Tbl, Number)
Edit: Also what does your table look like? Does it have those variable names?
6 comentarios
Alexander
el 25 de Abr. de 2023
Kevin Holly
el 25 de Abr. de 2023
Editada: Kevin Holly
el 25 de Abr. de 2023
What does your table look like in MATLAB? Does a column have all NaN values?
Edit: Also, if your spreadsheet has the variable names in them, you could just use the readtable function.
Kevin Holly
el 25 de Abr. de 2023
Editada: Kevin Holly
el 25 de Abr. de 2023
What happens if you remove those columns?
data = rand(8,3);
Tbl = array2table(data)
You can remove a column programmatically as such:
Tbl.data2 = []
FYI, you could use the import tool to import your data and then generate a function to import similar data files in the future. See link below.
Alexander
el 25 de Abr. de 2023
Kevin Holly
el 26 de Abr. de 2023
Is it possible that you can share your Excel sheet or one with similar data?
Categorías
Más información sobre Data Import from MATLAB 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!