I have a *.dat file that contains a numerical results, and I want to plot these results using Matlab. how can I open this file in Matlab? and if I want to store it in matrix,what should I do? . The file contains approx. 1000 row by 2 or 3 columns

1 回表示 (過去 30 日間)
Ahmed Ibrahim
Ahmed Ibrahim 2018 年 10 月 17 日
コメント済み: Jan 2018 年 10 月 17 日
I have a *.dat file that contains a numerical results, and I want to plot these results using Matlab. how can I open this file in Matlab? and if I want to store it in matrix,what should I do?

回答 (2 件)

madhan ravi
madhan ravi 2018 年 10 月 17 日
A=load('myfile.dat')
  3 件のコメント
Ahmed Ibrahim
Ahmed Ibrahim 2018 年 10 月 17 日
When I tried to upload, 'can't upload this file ,file format is unsupported' appears

サインインしてコメントする。


Jan
Jan 2018 年 10 月 17 日
It depends on how the data are store in the .dat file. There is no standard structure for this file extension, so it could be a binary or text file. So please post a small example of your file.
  3 件のコメント
Ahmed Ibrahim
Ahmed Ibrahim 2018 年 10 月 17 日
編集済み: Ahmed Ibrahim 2018 年 10 月 17 日
The file content is like that
and so on
Jan
Jan 2018 年 10 月 17 日
fid = fopen(FileName, 'r');
if fid == -1, error('Cannot open file: %s', FileName), end
fgetl(fid); % Skip first line
Data = fscanf(fid, '%g ', [3, inf]);
fclose(fid);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by