Ciao scusate il ritardo. Si effettivamente il codice del plottaggio sta all'interno degli script "ES: p_1.m". Ora vi carico il codice come l 'ho modificato per risolvere il problema delle call_back().
-> Cerco di essere piu chiaro alla domanda: "Dovresti anche chiarire cosa intendi con però non riesco a far plottare quel che voglio nell'apposita area: ottieni un messaggio di errore?"
Io vorrei che, dopo aver creato nella GUI l'area apposita per il plottaggio, dopo aver mandato in exec con la callback del pulsante lo script, il plot della mia funzione venga visualizzato non su una finestra generica come di solito fa matlab, ma bensi sull'interfaccia grafica stessa.
Spero stavolta di essermi fatto capire.
function varargout = prova(varargin)
%PROVA MATLAB code file for prova.fig
% PROVA, by itself, creates a new PROVA or raises the existing
% singleton*.
%
% H = PROVA returns the handle to a new PROVA or the handle to
% the existing singleton*.
%
% PROVA('Property','Value',...) creates a new PROVA using the
% given property value pairs. Unrecognized properties are passed via
% varargin to prova_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% PROVA('CALLBACK') and PROVA('CALLBACK',hObject,...) call the
% local function named CALLBACK in PROVA.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 prova
% Last Modified by GUIDE v2.5 10-Jun-2018 18:22:04
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @prova_OpeningFcn, ...
'gui_OutputFcn', @prova_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 prova is made visible.
function prova_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 prova
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes prova wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = prova_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 during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
% --- Executes on button press in plot1.
function plot1_Callback(hObject, eventdata, handles)
% hObject handle to plot1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of plot1
% --- Executes on button press in plot2.
function plot2_Callback(hObject, eventdata, handles)
% hObject handle to plot2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of plot2
% --- Executes on button press in plot3.
function plot3_Callback(hObject, eventdata, handles)
% hObject handle to plot3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of plot3
% --- Executes on button press in selectButton.
function selectButton_Callback(hObject, eventdata, handles)
% hObject handle to selectButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
cb_1 = get(handles.plot1,'Value');
cb_2 = get(handles.plot2,'Value');
cb_3 = get(handles.plot3,'Value');
if(cb_1)
p_1
end
if(cb_2)
p_2
end
if(cb_3)
p_3
end