`
jackchen0227
  • 浏览: 143384 次
  • 性别: Icon_minigender_1
  • 来自: 帝都
社区版块
存档分类
最新评论

用matlab读入文件,打印点

    博客分类:
  • misc
阅读更多
fdata = fopen('E:\iis\ftp&share\nodeList.txt','r');
A = fscanf(fdata,'%g',[2,100])
%放到一个二维数组
figure
text(A(1,1),A(2,1),'sink')
hold on
%需要hold on,否则画新的内容时候,旧的会被刷掉
plot(A(1,1),A(2,1),'o')
%下表从1开始,而不是从零开始
hold on
for index=2:100
    t = num2str(index)
    %将数字转换成字符串
    x = A(1,index)
    y = A(2,index)
    text(x,y,t)
    plot(x,y,'rx')
    hold on
end
fclose(fdata)

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics