PLEASE HELP! HOW TO SOLVE THIS ASCII FILE

So, I just download altimetry data which have asc format and I need to change NaN data into several number. But I dont know where to start because matlab is new to me. When I convert to excel, this file have 5 columns, and 709 rows. Let me know your answer :) Pls I need your help..

6 Comments

The file you attached is not ascii format.
because i cant upload that... thats why
"File format is unsupported. Use any of these formats: .bmp, .csv, .fig, .gif, .jpg, .jpeg, .m, .mlx, .mat, .mdl, .pdf, .png, .txt, .xls, .xlsx, .zip"
zip it and attach the .zip
Please do not close questions that have an answer.

Sign in to comment.

Answers (1)

t = readtable('j3p0001c073.asc', 'readvar', false, 'HeaderLines', 74, 'FileType','text', 'treatasempty', '*');

13 Comments

is it work on you? Because when I tried, I got this
"Undefined function 'readtable' for input arguments of type 'char'"
sorry for asking too many questions
It worked fine for me in R2018a.
Are you using a MATLAB release R2013a or earlier?
ncol = 66;
fmt = repmat('%f', 1, ncol);
filename = 'j3p0001c073.asc';
fid = fopen(filename, 'rt');
data = cell2mat( textscan(fid, fmt, 'HeaderLines', 74, 'CollectOutput',10, 'TreatAsEmpty', '*') );
fclose(fid);
yes, I use 2013 ver. And I've tried that and get errors too
the problem is
data = cell2mat( textscan(fid, fmt, 'HeaderLines', 74, 'CollectOutput',10, 'TreatAsEmpty', '*') );
What is the error message?
I just tried the code in R2013a on my system; it appears to work fine.
error in line.... data = cell2mat( textscan(fid, fmt, 'HeaderLines', 74, 'CollectOutput',10, 'TreatAsEmpty', '*') );
Ah, should be 1 after the 'CollectOutput', but that will not cause an error.
What is the error message? Does it say something about invalid property? Does it say something about an error converting cell arrays? Please show us everything that shows up in red.
Error using textscan Invalid file identifier. Use fopen to generate a valid file identifier.
Error in cobamatlab (line 8) data = cell2mat( textscan(fid, fmt, 'HeaderLines', 74, 'CollectOutput',10, 'TreatAsEmpty', '*') );
Invalid file identifier means that it was not able to open a file with that name.
To check: You did unzip jason3.zip into the directory you are running the code from?
After you unzip, the following files should be in the directory:
j3p0001c070.asc
j3p0001c071.asc
j3p0001c072.asc
j3p0001c073.asc
j3p0001c074.asc
j3p0001c075.asc
j3p0001c076.asc
j3p0001c077.asc
j3p0001c078.asc
j3p0001c079.asc
j3p0001c080.asc
j3p0001c081.asc
j3p0001c082.asc
j3p0001c083.asc
j3p0001c084.asc
j3p0001c085.asc
j3p0001c086.asc
j3p0001c087.asc
j3p0001c088.asc
j3p0001c089.asc
j3p0051c070.asc
j3p0051c071.asc
j3p0051c072.asc
j3p0051c073.asc
j3p0051c074.asc
j3p0051c075.asc
j3p0051c076.asc
j3p0051c077.asc
j3p0051c078.asc
j3p0051c079.asc
j3p0051c080.asc
j3p0051c081.asc
j3p0051c082.asc
j3p0051c083.asc
j3p0051c084.asc
j3p0051c085.asc
j3p0051c086.asc
j3p0051c087.asc
j3p0051c088.asc
j3p0051c089.asc
Ok sorry for my mistake... then how to change NaN to value number?
data(isnan(data)) = -99.9999 ???
this is my last question, pls answer this. How to save in ASCII?
save with the -ascii flag.

Sign in to comment.

Categories

Tags

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!