How to read x and y values from a text file?
17 次查看(过去 30 天)
显示 更早的评论
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
2022-9-13
You could start with READMATRIX.
If you want more help, upload a sample data file by clicking the paperclip button.
采纳的回答
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)';
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!