i have gui-based program with 2 buttons.
i wrote button 1's callback line:
--------------------------
function pushbutton1_Callback(hObject, eventdata, handles)
run test
--------------------------
When i click "button 1", it should run external .m file "test.m" . It works, it
open test.m file and make some calculation..
--------------------------
test.m :
a = 10
b = 20
assignin('base','a',a);
assignin('base','b',b);
--------------------------
i copy a and b variables to the workspace with using "assignin" command. Anyway,
everything is normal up to now.
Button 2 callback command is below.
--------------------------
function pushbutton2_Callback(hObject, eventdata, handles)
run test2.m
--------------------------
test2.m file contents:
--------------------------
c=a*b
--------------------------
When i click " button 2", it should run test2.m and it multiply "a" and "b" and
get "c" but still give error message :
"??? Error using ==> run
Undefined function or variable "a".
Although workspace has a and b variable, still gives that message.
if i didn't use gui based program, there would no problem. when i use gui,
it never save variables to the workspace, i can only use with handles but i need
to work with external files.
Sorry about my poor English, i hope you will understand what i'm saying. I
upload a screenshot from matlab.
http://img3.imageshack.us/img3/2815/16816462.jpg
thanks a lot
Regards.