accessing and comparing data from an excel file
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to load an excel file into matlab that contains a a column labeld 'id', that is seen as a type double, and a column labeld 'diagnosis', that is seen as a type cell. I loaded the file into matlab using the readtable() function and when I go to use the table2array() function inside the double() function, double(table2array(dataA)), I keep getting the error "Unable to concatenate the table variables 'id' and 'diagnosis', because their types are double and cell." Is there a way that I can change all the columns in the table into an array? I am trying to perform LDA and uLDA on the data set.
0 comentarios
Respuestas (1)
Walter Roberson
el 31 de Oct. de 2021
No, there is no way. MATLAB arrays must be uniform in data type. It is not possible to have a MATLAB array in which one column is double but another column is cell.
It would not surprise me if your diagnosis could be converted to string() or maybe even further to categorical() . However, you cannot mix double and string() or double and categorical() in a single array.
On the other hand, if you refer to https://www.mathworks.com/help/stats/discriminant-analysis.html then you will see that if you use fitcdiscr() then the measurements and the class information go into different inputs -- and so do not need to be put into a single array.
fitdiscr(T.id, t.diagnosis)
0 comentarios
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!