How to read x and y values from a text file?

조회 수: 24 (최근 30일)
youssef hany
youssef hany 2022년 9월 13일
댓글: David Hill 2022년 9월 13일
I have a text file with two columns of x and y values something like this:
4.3 2.3
1.1 2.9
.
.
I want to create one array for the x values and another one for the y values so the result is like this:
x=[4.3 1.1 . . .]
y=[2.3 2.9 . . .]
Any help?!
If it's not possible just tell me how can I create an array of float numbers from a text file?
  댓글 수: 2
Stephen23
Stephen23 2022년 9월 13일
You could start with READMATRIX.
If you want more help, upload a sample data file by clicking the paperclip button.
youssef hany
youssef hany 2022년 9월 13일
I've attached the file

댓글을 달려면 로그인하십시오.

채택된 답변

David Hill
David Hill 2022년 9월 13일
편집: David Hill 2022년 9월 13일
Should attach file for us to test.
m=readmatrix('points.txt');
x=m(:,1)';y=m(:,2)';
  댓글 수: 2
youssef hany
youssef hany 2022년 9월 13일
I've attached the file
David Hill
David Hill 2022년 9월 13일
The above works.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by