NEED HELP FAST! I have several problem about ASCII file.

So, I have a ASCII data file with unknown number (NaN). My teacher want me to change NaN into -99.9999. But when I tried so many times, the undefined variable error is appear. WHAT SHOULD I DO? Pls I appreciate if anyone can help :))

Answers (1)

What did you try? Did you try the obvious
data(isnan(data)) = -99.9999;
?? What error message did you get?

6 Comments

By the way, that's an Excel workbook file, not an ASCII text file.
A = xlsread('COBA','Sheet1','A1:E709')
A(isnan(A))= -99.9999
so, the excel file not showing all data....
column E is considered text data by Excel since there is no equals sign there. To get everything, try this:
[numbers, strings, raw] = xlsread('COBA.xlsx');
numbers(isnan(numbers)) = -99.9999;
strings will be a cell array of your strings in column e. If you want to parse the strings into numbers, use textscan(), or sscanf(), or strsplit() with str2double().
i dont understand with "If you want to parse the strings into numbers, use textscan(), or sscanf(), or strsplit() with str2double()". Can you give me an exemple with my data?
It would be easier to go back to the original text data and import that properly, than to continue working with this badly input .xlsx

Sign in to comment.

Asked:

on 18 Jul 2018

Reopened:

on 22 Dec 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!