how to make passing parametes between GUI and *.m files
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
%================== in my gui file
mygui.m
-------
function pushbutton1_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.avi';'*.mpeg'}, 'Pilih Video');
set(handles.edit1,'string',[pathname filename]);
guidata(hObject, handles);
%call my 'myfile.m'
mymfile
%================== in my *.m file
mymfile.m
-------
function obj = setupSystemObjects()
urlfiles = get(handles.edit1,'string');
obj.reader = vision.VideoFileReader(urlfiles);
how to passing '[pathname filename]' in 'handels.edit1' to variabel 'urlfiles' in my 'mymfiles.m' cause i still get error.
"The class "handles" is undefined. Perhaps Java is not running."
0 Kommentare
Antworten (1)
Geoff Hayes
am 14 Jan. 2015
Fitroh - why not just pass the list of videos to your setupSystemObjects function (which is presumably saved to a file called setupSystemObjects.m and not in myfile.m) as an input parameter? Change the signature and body of this function to
function obj = setupSystemObjects(videoFiles)
obj.reader = vision.VideoFileReader(videoFiles);
% etc.
and then call this function from your callback as
function pushbutton1_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.avi';'*.mpeg'}, 'Pilih Video');
videoFiles = [pathname filename];
set(handles.edit1,'string', videoFiles);
setupSystemObjects(videoFiles);
Try the above and see what happens! The alternative is to use global variables, but that is something that can be avoided here.
0 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!