Matlab:成功解决引用了已清除的变量 handles

Matlab:成功解决引用了已清除的变量 handles

 

目录

解决问题

解决方法


 

 

 

这个破问题耽误了我半个多小时,what fuck!!气死laozi了
哈哈,还好,完美解决!

 

解决问题

解决引用了已清除的变量 handles

 

 

 

解决方法

函数都写对了,但就是出错,开始绝望!!经过各种百度,谷歌,终于找到了原因,

是因为在最前边写了,

去掉清除变量命令即可!!!

哈哈,解决!!

 

 

发布了1565 篇原创文章 · 获赞 6121 · 访问量 1196万+

MATLAB GUI handles 无法传递?!!

03-28

如下,MATLAB GUI handles 完全无法传递,function pushbutton1 完全得不到已经公共化的 PATH, Out 取值,这说明handles 没有传递出去,但到底是为什么?已略去各种注释和无关紧要的语句,方便大神们阅读,小妹跪求大神指点迷津。在 GUI__OpeningFcn 中定义 Global 也没有作用,不知什么原因?10个C币,望大神们不吝赐教。_ function [varargout,handles] = GUI(varargin) gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @GUI_OpeningFcn, ... 'gui_OutputFcn', @GUI_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end function GUI_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; guidata(hObject, handles) handles = guidata(hObject); handles.PATH=handles.edit1.String; handles.Out_Address=handles.edit2.String; function varargout = GUI_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output; handles.PATH=handles.edit1.String; handles.Out_Address=handles.edit2.String; function edit1_Callback(hObject, eventdata, handles) function edit1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit2_Callback(hObject, eventdata, handles) function edit2_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end handles function pushbutton1_CreateFcn(hObject, eventdata, handles) function pushbutton1_ButtonDownFcn(hObject, eventdata, handles) function pushbutton1_Callback(hObject, eventdata, handles) PATH=handles.PATH Out_Address=handles.Out_Address 问答

尝试引用已删除的函数???

05-26

#pragma once #include<string> #include<iostream> using namespace std; static int number = 0; class Student { protected: int m_ID; string m_Name; string m_Sex; string m_Tel; int m_English; public: Student(int ID = 0, string Name = "δ֪", string Sex = "δ֪", string Tel = "δ֪", int English = 0) { m_ID = ID; m_Name = Name; m_Sex = Sex; m_Tel = Tel; m_English = English; number++; } Student(const Student &s) { m_ID = s.m_ID; m_Name = s.m_Name; m_Sex = s.m_Sex; m_Tel = s.m_Tel; m_English = s.m_English; number++; } ~Student() { number--; } friend istream operator>>(istream &in, Student &s) { in >> s.m_ID >> s.m_Name >> s.m_Sex >> s.m_Tel >> s.m_English; return in; } friend ostream operator<<(ostream &out, const Student &s) { out << s.m_ID << s.m_Name << s.m_Sex << s.m_Tel << s.m_English; return out; } };#pragma once #include"student.h" class Graduate :public Student { protected: string m_Majorfield; string m_Papers; public: Graduate(int ID = 0, string Name = "δ֪", string Sex = "δ֪", string Tel = "δ֪", int English = 0, string Majorfield="δ֪", string Papers="δ֪") :Student(ID,Name,Sex,Tel,English) { m_Majorfield = Majorfield; m_Papers = Papers; number++; } Graduate(const Graduate&s) { m_ID = s.m_ID; m_Name = s.m_Name; m_Sex = s.m_Sex; m_Tel = s.m_Tel; m_English = s.m_English; m_Majorfield = s.m_Majorfield; m_Papers = s.m_Papers; number++; } ~Graduate() { number--; } /*friend istream operator>>(istream &in, Graduate &s) { in >> s.m_ID >> s.m_Name >> s.m_Sex >> s.m_Tel >> s.m_English >> s.m_Majorfield >> s.m_Papers; return in; } friend ostream operator<<(ostream &out, Graduate &s) { out<< s.m_ID <<endl <<s.m_Name <<endl <<s.m_Sex <<endl <<s.m_Tel <<endl <<s.m_English <<endl <<s.m_Majorfield <<endl <<s.m_Papers<<endl; return out; }*/ };#pragma once #include"student.h" class Undergraduate :public Student { protected: int m_Math; int m_Cpp; public: Undergraduate(int ID = 0, string Name = "δ֪", string Sex = "δ֪", string Tel = "δ֪", int English = 0, int Math = 0, int Cpp = 0) :Student(ID, Name, Sex, Tel, English) { m_Math = Math; m_Cpp = Cpp; number++; } Undergraduate(const Undergraduate &s) { m_ID = s.m_ID; m_Name = s.m_Name; m_Sex = s.m_Sex; m_Tel = s.m_Tel; m_English = s.m_English; m_Math = s.m_Math; m_Cpp = s.m_Cpp; number++; } ~Undergraduate() { number--; } /*friend istream operator>>(istream &in, Undergraduate &s) { in>> s.m_ID >> s.m_Name >> s.m_Sex >> s.m_Tel >> s.m_English >> s.m_Math >> s.m_Cpp; return in; } friend ostream operator<<(ostream &out, Undergraduate &s) { out<<s.m_ID <<endl <<s.m_Name <<endl <<s.m_Sex <<endl <<s.m_Tel <<endl <<s.m_English <<endl <<s.m_Math <<endl <<s.m_Cpp<<endl; return out; }*/ }; #pragma once #include"student.h" template<typename T> class LinkList; template<typename T> class Node { private: T *data; Node *next; public: Node(T t) { data = &t; next = NULL; } Node() { next =NULL } ~Node() { next = NULL; } T SetData(T &t) { data = &t; } void ShowData() { cout << data<<endl; } friend LinkList; }; template<typename T> class LinkList { protected: Node *m_head; public: LinkList() { this->m_head = NULL; } void InsertAtHead(const Node &t) { Node *p; p = new Node(t); p->next = m_head; m_head = p; } void show() { Node *p; p = m_head; while (p != NULL) { p->ShowData(); p = p->next; } cout << endl; } }; #include"链表.h" #include"graduate.h" #include"undergraduate.h" template<typename T> void main() { LinkList<Student> list1; list1.InsertAtHead(Student(5,"xiaosan","man","12132132132",98)); list1.show(); } 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 代码科技 设计师: Amelia_0503

分享到微信朋友圈

×

扫一扫,手机浏览