Imported Numbers from excel are replaced by NaN!!(?)

8 Ansichten (letzte 30 Tage)
Panos Ale
Panos Ale am 27 Mai 2017
Kommentiert: Star Strider am 28 Mai 2017
Hello! I am trying trying to import(create a numeric matrix) some values from excel which have about 13 decimals but matlab relpaces them with NaN. What can I do?
  2 Kommentare
John D'Errico
John D'Errico am 27 Mai 2017
Well, since we cannot replicate what you get, how can we help? Posting a spreadsheet where this happens, then showing how you tried to do the import would make it easier to help you. Attach a spreadsheet to a comment.
Panos Ale
Panos Ale am 27 Mai 2017
Here is the file! Thank toy for your help and understanding!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 27 Mai 2017
importdata() cannot deal with using comma as the decimal separator.
Unfortunately to handle numbers that use comma as the decimal separator, you must replace the command with period before converting to numeric. For example if you have a cell array of strings, then
numeric_data = str2double( regexp(YourCellArrayOfStrings, ',', '.') )

Weitere Antworten (1)

Star Strider
Star Strider am 27 Mai 2017
The NaN values in the numeric output matrix usually occur if the Excel file cells are blank or have string data. Without seeing your Excel file, it is not possible to determine exactly what the problem may be otherwise.
  3 Kommentare
Panos Ale
Panos Ale am 28 Mai 2017
Bearbeitet: Panos Ale am 28 Mai 2017
I did it this way and it works fine for me too! Thanks!
Star Strider
Star Strider am 28 Mai 2017
My pleasure!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Type Conversion 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!

Translated by