Importing values from excel
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone, I'm trying to import datas from Excel to Matlab by using xlsread. my problem is that, it doesn't bring all of the values to command window but I can see the values in Workspace.It says NaN for cells such as 'DFX' or '78669-87'. I can't use import data all the time because the excel file needs to be updated everyday. So what I need is a code which can bring every values in each update to MaTLAB Is there another way to bring the datas? or any recommendation? Thank you:)
1 Kommentar
Antworten (1)
dpb
am 6 Aug. 2018
"...It says NaN for cells such as 'DFX' or '78669-87'."
As rightfully it should for numeric values; those aren't numbers but text in those cells.
If your data file format isn't regular you have to have some way to know which data are in which rows/columns to be able to interpret it correctly; xlsread will bring back every cell in the third (optional) output and you can parse it from there...
[n,t,r]=xlsread(...
n is the data which could be read as numeric, t is the text and r is the "raw" content of all cells of whatever type as a cell array from which one can tell exactly where any given piece of information is(*) for parsing the content programmatically.
It's much simpler if you can regularize the spreadsheet itself first.
(*) I think mayhaps behavior is different than was but will need to verify for your version in that the size of the n and r arrays originally was NOT the same as for r so that finding the location of a field label in r didn't actually correlate to where in n it's associated values actually were. I believe that has been fixed, but as noted you'll need to verify behavior to be sure.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!