Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2009-11-06
帖子: 2
声望力: 0 ![]() |
![]()
如下:
function generate_all_the_graphes() % generate all the graphs from the data with data name clear;clc; for index=0:1:5 sub_plot_one_graph(index); end function sub_plot_one_graph(i) %subroutine to plot each graph for each data sheet in the current folder name =sprintf('%08d',i); full_name = ['xyzbead' name '.dat']; fid =fopen(full_name,'r'); [data,count]=fscanf(fid,'%f'); %%以后就是赋值、plot、saveas的顺序了,因为出错就在上面这部分,故下面的略掉%% 运行后老说 ??? Error using ==> fscanf Invalid file identifier. Use fopen to generate a valid file identifier. Error in ==> sub_plot_one_graph at 7 [data,count]=fscanf(fid,'%f')%% fscanf() input the chosen data to assign the variable vector "data" 我单独运行子程序(先设好index),看的到有fid产生,但从主程序开始运行却说fid不正确,然后导致文件打不开。搞不懂怎么回事?是参数传递的写法不正确吗?还是程序本身有问题?高手能教教我吗?今天整了一整天就是想整出这个程序来。先谢过了。 此帖于 2009-11-06 22:33 被 lj454802765 编辑。 原因: 问题已经解决 |
![]() |
![]() |