Convert tablet to matrix
Ältere Kommentare anzeigen
My code:
filename='Excelspreadsheet.xlsx';
Data=readtable(filename)
7×3 table
Classes Hours Grades
{'CHM' } 3 {'C'}
{'Calc' } 4 {'A'}
{'CHM lab' } 2 {'F'}
{'College comp'} 4 {'D'}
{'ECAL' } 1 {'A'}
{'MHCS' } 1 {'B'}
{'EGE' } 1 {'A'}
A=4;B=3;C=2;D=1;F=0;
Problem:
What I'm trying to do is to either convert the characters under grades to something which allows me to convert this table into a matrix. Or my other solution would be to convert the grades to the corresponding numbers which I have written in the code. However, I can't get it to work.
3 Kommentare
Nils Hammarsten Brywe
am 5 Nov. 2021
Cris LaPierre
am 5 Nov. 2021
Why can't you keep it a table?
Nils Hammarsten Brywe
am 5 Nov. 2021
Akzeptierte Antwort
Weitere Antworten (2)
Sulaymon Eshkabilov
am 5 Nov. 2021
You can consider to convert it into cell array and matrix arrays, e.g.:
CLS = table2array(T(:,1)) % Cell Array
HRS = table2array(T(:, 2)) % Matrix Array
GRD = table2array(T(:,3)) % Cell Array
Nils Hammarsten Brywe
am 5 Nov. 2021
0 Stimmen
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!