how to pass mat files by reference to the function?
Show older comments
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.
Accepted Answer
More Answers (1)
Image Analyst
on 24 Jul 2016
0 votes
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
Categories
Find more on Whos 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!