how to pass mat files by reference to the function?
이전 댓글 표시
net=load('data/vgg_face.mat');
% --- Executes on button press in upl_img.
function upl_img_Callback(hObject, eventdata, handles)
%passing the image to the network
im_ = single(im) ; % note: 255 range
im_ = imresize(im_, net.meta.normalization.imageSize(1:2));
im_ = bsxfun(@minus,im_,net.meta.normalization.averageImage);
res = vl_simplenn(net, im_);
scores = squeeze(gather(res(end).x));
[bestScore, best] = max(scores);
% printing scores
set(handles.output_score, 'String', net.meta.classes.description{best});
guidata(hObject,handles);
I want the mat file loaded in 'net' to be used inside the function upl_img_callback. How can i do so. I cannot declare net inside the function since everytime this function is called this huge mat file(1 GB) is loaded into the ram again. net is defined in the m file like shown. I don't know how to pass it as argument either since this mat file is defined in the same m file as the function. Please help.
채택된 답변
추가 답변 (1개)
Image Analyst
2016년 7월 24일
0 개 추천
See the FAQ for several options: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
카테고리
도움말 센터 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!