function popupmenu7_Callback(hObject, eventdata, handles)% hObject handle to popupmenu7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu7 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu7
v=get(handles.popupmenu7,'Value')if v == 1 X1=get(handles.edit1, 'String'); X2=get(handles.edit4, 'String'); X3=get(handles.edit7, 'String'); X4=get(handles.edit10, 'String'); Z=[X1 X2 X3 X4]elseif v == 2 Y1=get(handles.edit2, 'String'); Y2=get(handles.edit5, 'String'); Y3=get(handles.edit8, 'String'); Y4=get(handles.edit11, 'String'); Z=[Y1 Y2 Y3 Y4]elseif v == 3 Z1=get(handles.edit3, 'String'); Z2=get(handles.edit6, 'String'); Z3=get(handles.edit9, 'String'); Z4=get(handles.edit12, 'String'); Z=[Z1 Z2 Z3 Z4]endimage=uigetfile('*.png', 'File Selector');imshow(image)axes=handles.axes1;hold on;maxAllowablePoints = 5; % Whatever you want.
numPointsClicked = 0;promptMessage = sprintf('Left click up to %d points.\nRight click when done.', maxAllowablePoints);titleBarCaption = 'Continue?';button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');if strcmpi(button, 'Cancel') return;endwhile numPointsClicked < maxAllowablePoints numPointsClicked = numPointsClicked + 1; [x(numPointsClicked), y(numPointsClicked), button] = ginput(1) if button == 3 % Exit loop if
break; endend% Print to command window
xyZmsgbox('Done collecting points');patch(handles.axes1, x,y,Z, 'Facecolor', 'interp')hold off
i am using this code to plot on the image but getting error as follows
Error using patchVectors must be the same lengths.Error in imgplt3d>popupmenu7_Callback (line 643)patch(handles.axes1, x,y,Z, 'Facecolor', 'interp')Error in gui_mainfcn (line 96) feval(varargin{:});Error in imgplt3d (line 42) gui_mainfcn(gui_State, varargin{:});Error in @(hObject,eventdata)imgplt3d('popupmenu7_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating uicontrol Callback
please help me
Best Answer