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

23 Ansichten (letzte 30 Tage)
youssef hany
youssef hany am 13 Sep. 2022
Kommentiert: David Hill am 13 Sep. 2022
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 Kommentare
Stephen23
Stephen23 am 13 Sep. 2022
You could start with READMATRIX.
If you want more help, upload a sample data file by clicking the paperclip button.
youssef hany
youssef hany am 13 Sep. 2022
I've attached the file

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

David Hill
David Hill am 13 Sep. 2022
Bearbeitet: David Hill am 13 Sep. 2022
Should attach file for us to test.
m=readmatrix('points.txt');
x=m(:,1)';y=m(:,2)';
  2 Kommentare
youssef hany
youssef hany am 13 Sep. 2022
I've attached the file
David Hill
David Hill am 13 Sep. 2022
The above works.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by