在 MATLAB 中绘制图形
我有一个 txt 文件,每行包含以下值:
SRNO Value1 Value2
大约有 2000 个这样的行。
我想在 MATLAB 中绘制 Value1 和 Value2 有
关于如何做到这一点的代码吗?谢谢
I have a txt file with the following values on each line:
SRNO Value1 Value2
There are around 2000 such lines.
I would like to plot both Value1 and Value2 in MATLAB
Any code on how I could do it? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一个简单的 load 然后 plot 就可以做到:
A simple load then plot would do it:
绘图很简单:
您遇到的真正问题是尝试将值读入程序中。查看帮助文档中的csvreader函数或文件读取。 csvread() 帮助文档看起来需要一个真正的逗号分隔值文件,但帮助 dox 链接到 textscan() 看起来更好:
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/textscan.html
Plotting is straightforward:
The real problem you have is trying to read the values into the program at all. Check out the csvreader functions or file reading in the help documentation. csvread() help docs looks like it requires a real comma separated values file, but the help dox link to textscan() which looks better:
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/textscan.html
尝试这样的操作:
%*s
应该删除文本并留下 x,y 值。不确定这是否是您想要做的,但请查看 plot 和 textscan 了解更多信息。try something like this:
The
%*s
should remove the text and leave you with x,y values. Not sure if that is what you are looking to do, but check out plot and textscan for more info.