how to read .data format data using matlab code??

6 views (last 30 days)
for example the file contains 4,43,1,1,?,1 this type format.i attached data file.please help how to read the data file

Answers (1)

Jan
Jan on 3 May 2016
Edited: Jan on 6 May 2016
Str = fileread(FileName);
Str = strrep(Str, '?', 'NaN'); % EDITED, "Str, " inserted
Str = strrep(Str, char(10), ',');
Value = sscanf(Str, '%f,');
Value = reshape(Value, 5, []).';
  2 Comments
Gayathri varu
Gayathri varu on 4 May 2016
sir,i try this the error occured.the error type is not enough input argument.
Jan
Jan on 6 May 2016
Yes, there have been some typos. They are fixed now.

Sign in to comment.

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!