Imported Numbers from excel are replaced by NaN!!(?)
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
John D'Errico
2017-5-27
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.
采纳的回答
Walter Roberson
2017-5-27
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, ',', '.') )
更多回答(1 个)
Star Strider
2017-5-27
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!