无所谓1248 无所谓1248
关注数: 7 粉丝数: 4 发帖数: 39 关注贴吧数: 3
新手求大家帮帮忙,运行总是出错 按照视频教程做了gui导入成绩,求大家看看哪错了 % --- Executes just before untitled2chengji is made visible. function untitled2chengji_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to untitled2chengji (see VARARGIN) % Choose default command line output for untitled2chengji handles.output = hObject; fin=fopen('C:\Users\Administrator\Desktop\chengji.txt','r'); str=fgetl(fin);%从这里读第一行文件 [str1 str2 str3 str4]=strread(str,'%s %s %s %s','delimiter',' ');%从上一个str中读取 xingming(1)=str1;%第一行读完 counter=2;%第二行开始读 while feof(fin)==0 %没有遇到文件尾就继续往下读 str=fgetl(fin); [name, yuwen, shuxue, yingyu]=strread(str,'%s %d %d %d','delimiter',' '); xingming(counter)=name; chengji(counter-1,:)=[yuwen shuxue yingyu];%每一行分别显示3个数据 counter=counter+1; end set(handles,listbox1,'string',xingming); % Update handles structure guidata(hObject, handles); 一直在报错 未定义函数或变量 'listbox1'。 出错 untitled2chengji>untitled2chengji_OpeningFcn (line 73) set(handles,listbox1,'string',xingming); 出错 gui_mainfcn (line 220) feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:}); 出错 untitled2chengji (line 42) gui_mainfcn(gui_State, varargin{:});
1 下一页