Data (.txt) into matrix

13 ビュー (過去 30 日間)
Kdshdc Kdshdc
Kdshdc Kdshdc 2019 年 10 月 22 日
編集済み: the cyclist 2019 年 10 月 22 日
I have a set of data and I wanna convert it to a matrix in Matlab, so that i can see the model.
The data comes from a different program, and it is organized in a line, where the first number means the x variable, the second means the y variable, and the ";" separates the point.
How can I make a matrix out of it so that I can plot the model?
I've attached the first data.
Thank you very much.
  2 件のコメント
the cyclist
the cyclist 2019 年 10 月 22 日
I don't see any data attached.
the cyclist
the cyclist 2019 年 10 月 22 日
Moved their attachment here, instead of as an "answer".

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

採用された回答

the cyclist
the cyclist 2019 年 10 月 22 日
編集済み: the cyclist 2019 年 10 月 22 日
This works on the small file I attached here. If the format is not exactly what you have, maybe you can still figure out how to do it from this start.
fid = fopen('data.txt');
C = textscan(fid,'%f,%f;');
fclose(fid)
  1 件のコメント
the cyclist
the cyclist 2019 年 10 月 22 日
編集済み: the cyclist 2019 年 10 月 22 日
It seems to have worked on the file you uploaded as well. (Note that I moved your file to a comment on the question, instead of being an "answer".)

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by