Info

此问题已关闭。 请重新打开它进行编辑或回答。

erroneous read data from grid file related to digits formatting

1 次查看(过去 30 天)
Hello everybody
i have a weird formated ascii file, that is quite similar with the one discussed here.
after removing all unrelated text from the file , I end up with a cell containgin all the numbers and i have to change it to double format.
in order to do that i use
data(:,:,i) = reshape( sscanf( blocks, '%4d' ), 1440, 720 ).' ;
the format is that data could be either 3 or 4 digit. when 3 digit, there is a whitespece before the value. when 4 digits are succesive the ascci looks like
559 584 656 84811281610184216791461128412291089 667 574
but matlab format the output as
559 584 656 8481 1281 6101 ...
instead of
559 584 656 848 1128 1610...
i have checked the output char and
the fisrt value is whitespace. and checked every 4th value (5,9 etc) for this line and seem correct (whitespace when 3 digit data, first digi when 4-digit data)/
i have tried replacing whitespaces with zeros
but still reads the same erroneous data.
so any idea of how to handle this would be really helpful

回答(0 个)

此问题已关闭。

标签

产品


版本

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by