script doesn't run from gui
1 view (last 30 days)
Show older comments
I created a script called v1s, if I run that scrip from command windows, that script run excellent , but if I calle that script from a GUI (boton funtion) in the command windows appears the following:
Undefined variable "v1s" or class "v1s.m".
Error in Principal>pushbutton2_Callback (line 88)
v1s.m
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in Principal (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Principal('pushbutton2_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I want know how call a script from a button funcion in a GUI
v1s script is:
v6(TbDate,vib1pp,TbDate(vib1pp>ppmax),vib1pp(vib1pp>ppmax),TbDate,vib1ap,TbDate(vib1ap>5),vib1ap(vib1ap>5),TbDate,vib1pd,TbDate(vib1pd>45),vib1pd(vib1pd>45),TbDate,vib1ad,TbDate(vib1ad>20),vib1ad(vib1ad>20),TbDate,vib1pf,TbDate(vib1pf>85),vib1pf(vib1pf>85),TbDate,vib1af,TbDate(vib1af<80),vib1af(vib1af<80))
if a pass all the value from GUI my graph is wrong.
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
global TbDate vib1pp vib1ap vib1pd vib1ad vib1pf vib1af ppmax
v6(TbDate,vib1pp,TbDate(vib1pp>ppmax),vib1pp(vib1pp>ppmax),TbDate,vib1ap,TbDate(vib1ap>5),vib1ap(vib1ap>5),TbDate,vib1pd,TbDate(vib1pd>45),vib1pd(vib1pd>45),TbDate,vib1ad,TbDate(vib1ad>20),vib1ad(vib1ad>20),TbDate,vib1pf,TbDate(vib1pf>85),vib1pf(vib1pf>85),TbDate,vib1af,TbDate(vib1af<80),vib1af(vib1af<80))
0 Comments
Answers (1)
Adam
on 4 Mar 2015
Edited: Adam
on 4 Mar 2015
You should call the script my its name without '.m' attached i.e. just
v1s
not
v1s.m
The script will run in the scope of the pushbutton callback, whether that is what you want or not I don't know.
4 Comments
Image Analyst
on 8 May 2016
Edited: Image Analyst
on 8 May 2016
Ankit, that doesn't make sense - finish your sentence or expand on what you're saying.
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!