Filter löschen
Filter löschen

how to drag image in matlab?

4 Ansichten (letzte 30 Tage)
preeti
preeti am 25 Apr. 2015
Bearbeitet: Stephen23 am 28 Apr. 2015
This is GUI suppose if I want user to move image from axes 1 to axes 2 what should be inserted in GUI CODE The code is-
function varargout = untitled1(varargin)
% UNTITLED1 MATLAB code for untitled1.fig
% UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
% singleton*.
%
% H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
% the existing singleton*.
%
% UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED1.M with the given input arguments.
%
% UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled1_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help untitled1
% Last Modified by GUIDE v2.5 25-Apr-2015 13:42:56
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled1_OpeningFcn, ...
'gui_OutputFcn', @untitled1_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before untitled1 is made visible.
function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled1 (see VARARGIN)
% Choose default command line output for untitled1
handles.output = hObject;
axes(handles.axes1)
imshow('rice.png')
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled1_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
Thanks in advance
  3 Kommentare
Geoff Hayes
Geoff Hayes am 27 Apr. 2015
@Preeti - how would you like to move the image from one axes to the other? You mention drag in your question but I don't think that is possible. You may have to add a push button to your GUI so that, when pressed, it will copy the image that is shown in axes1 to be drawn in axes2. Would this be acceptable?
preeti
preeti am 27 Apr. 2015
Yes that will work but as shown in attachment I want only clicked radio button images to be copied sequentially in Relevant image panel. Predefined reservations of axis in relevant image panel will be difficult. Please suggest ...

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 27 Apr. 2015
You can't click and drag an image from one axes to another (unless you're Yair who probably knows how to do it via undocumented calls). But you can display it in a different axes if you have access to the variable. See the FAQ http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F for ways to do that.
  5 Kommentare
Image Analyst
Image Analyst am 27 Apr. 2015
He's probably the only one who would know.
preeti
preeti am 28 Apr. 2015
thanks will find it out..:)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by