Why Matlab doesn't see part of the excel sheet?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I read multiple sheets excel file with following code:
Sheets = sheetnames(FileName);
for i = 1 : length(Sheets)
Name = Sheets{i};
data{i} = readmatrix(FileName,'Sheet',Name);
end
Each sheet looks the same: A1 cell is "Student ID" and A2 is "#" (ID number).
B1 is "Math grades", B2, B3, etc - grades (just numbers).
When I look at data cell array I see that some cells have this first row with ID, and some don't.
Any idea why is that?
Thank you!!
2 Commenti
Risposte (1)
Image Analyst
il 28 Ott 2021
"data" is a cell array because you used braces, not because that's what readmatrix() returns. Actually readmatrix() returns a numerical matrix - a double - which has no strings at all in it. And it's putting that numerical/double matrix into the ith cell of data.
If you want a cell array, so that it will have both numbers and strings, instead of a matrix, then use readcell() instead of readmatrix().
Please read the FAQ on cell arrays and you will understand better.
0 Commenti
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!