I exported data from excel into a table, how do I sum the values of each column from that table excluding NaN's
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
T = readtable('Inventory.xlsx')
%now I need to sum each column, for example the data in column 2 is for Copper
0 comentarios
Respuestas (1)
Star Strider
el 20 de Mayo de 2022
Two options —
T = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1005700/Inventory.xlsx')
S1 = nansum(T{:,2:end})
S2 = sum(T{:,2:end},'omitnan')
Both give the same result.
.
2 comentarios
Star Strider
el 20 de Mayo de 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
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!