Why is this variable still undefined in GUI?
1 view (last 30 days)
Show older comments
Dear all,
I have GUI and I have a problem with variable shape. This error:
Undefined function or variable "shape".
Error in DP_segment_final>pushbutton5_Callback (line 383)
shape.thorax = fourier_fit(fourier_fit(shape.thorax, Ncomps), linspace(0, 1, Npts1));
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in DP_segment_final (line 44)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)DP_segment_final('pushbutton5_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I attach my code, figure and my original image. Thank you for your answers.
0 Comments
Answers (1)
Jan
on 15 Feb 2017
The variable is properly created some lines above:
tmp = bwboundaries(handles.binaryImage_okoli);
shape.thorax = tmp{1};
But this code is not called, if 'okraje_modelu.mat' is existing. Then:
if 2==exist ('okraje_modelu.mat')
load ('okraje_modelu')
disp('Okraje modelù byly naèteny.')
Reading the code you cannot predict, what the load command injects in the workspace. Therefore it is much clearer and safer, to catch the output:
Data = load ('okraje_modelu');
shape = data.shape;
Then you will get a useful error message in case of a missing variable.
You can use the debugger to examine, what's going on. Set a breakpoint in the first line of the callback and step through the code line by line. Check in the Workspace Browser, of the wanted variable occurres.
0 Comments
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!