I am trying to import data from excel file to matlab. But, matlab is recognizing the numbers as NaN.
How can I solve it?
I am attaching the excel file containing all data.
Thanks, Majbah
Best Answer
At row 11919 you have a divide by zero in Excel and that's giving you a nan in the array. The rest of the array elements are the correct numbers though.
MATLAB only recognizes the period character as the decimal radix, so you will need to change that comma character before converting to numeric. To achieve this when reading the file with MATLAB, you could do something like this:
There is something strange going on with that data-file, but if the file is a simple tab-delimited text-file (attached), then this code will import and plot that data:
fid = fopen('distortion.txt','rt');
M = cell2mat(textscan(fid,'%f%f%f%f%f','HeaderLines',1));
Best Answer