image thumbnail

GUI to assist with combining/pulling out figures and subplots

by

 

This GUI assists with generating new figures using data in existent figures.

figure_helper(varargin)
function varargout = figure_helper(varargin)
%FIGURE_HELPER M-file for figure_helper.fig
%      FIGURE_HELPER, by itself, creates a new FIGURE_HELPER or raises the existing
%      singleton*.
%
%      H = FIGURE_HELPER returns the handle to a new FIGURE_HELPER or the handle to
%      the existing singleton*.
%
%      FIGURE_HELPER('Property','Value',...) creates a new FIGURE_HELPER using the
%      given property value pairs. Unrecognized properties are passed via
%      varargin to figure_helper_OpeningFcn.  This calling syntax produces a
%      warning when there is an existing singleton*.
%
%      FIGURE_HELPER('CALLBACK') and FIGURE_HELPER('CALLBACK',hObject,...) call the
%      local function named CALLBACK in FIGURE_HELPER.M with the given input
%      arguments.
%
%      *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 figure_helper

% Last Modified by GUIDE v2.5 25-Jan-2013 12:09:47

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @figure_helper_OpeningFcn, ...
                   'gui_OutputFcn',  @figure_helper_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 figure_helper is made visible.
function figure_helper_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   unrecognized PropertyName/PropertyValue pairs from the
%            command line (see VARARGIN)

% Choose default command line output for figure_helper
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes figure_helper wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = figure_helper_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;


% --- Executes on button press in subplot_to_figure_button_Callback.
function subplot_to_figure_button_Callback(hObject, eventdata, handles)
% hObject    handle to subplot_to_figure_button_Callback (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handle_array = get_array_from_editbox1;
figure(handle_array)
subplot_to_figure;


% --- Executes on button press in integrate_subplots_button.
function integrate_subplots_button_Callback(hObject, eventdata, handles)
% hObject    handle to integrate_subplots_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handle_array = get_array_from_editbox1;
integrate_subplots(handle_array);


% --- Executes on button press in integrate_plots_button.
function integrate_plots_button_Callback(hObject, eventdata, handles)
% hObject    handle to integrate_plots_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handle_array = get_array_from_editbox1;
integrate_plots(handle_array);

% --- Executes on button press in figures_to_subplot_button.
function figures_to_subplot_button_Callback(hObject, eventdata, handles)
% hObject    handle to figures_to_subplot_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handle_array = get_array_from_editbox1;
figures_to_subplot(handle_array);


function edit_box1_Callback(hObject, eventdata, handles)
% hObject    handle to edit_box1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_box1 as text
%        str2double(get(hObject,'String')) returns contents of edit_box1 as a double


% --- Executes during object creation, after setting all properties.
function edit_box1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_box1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function handle_array = get_array_from_editbox1()
handle_array_str = get(findobj('tag','edit_box1'),'String');
% get rid of potential brackets
handle_array_str = regexprep(handle_array_str,'\[|\(|\]|\)','');
handle_array = eval(['[',handle_array_str,']']);


% --- Executes on button press in pull_data_from_line_button.
function pull_data_from_line_button_Callback(hObject, eventdata, handles)
% hObject    handle to pull_data_from_line_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handle_array = get_array_from_editbox1;
figure(handle_array)
X = get(gco,'XData');
Y = get(gco,'YData');
pulled_data = [X;Y];
assignin('base','data_from_line',pulled_data)

Contact us