• Non ci sono risultati.

APPENDICE 4 Alleghiamo in questa sezione il programma che genera l’interfaccia utente.

N/A
N/A
Protected

Academic year: 2021

Condividi "APPENDICE 4 Alleghiamo in questa sezione il programma che genera l’interfaccia utente."

Copied!
16
0
0

Testo completo

(1)

APPENDICE 4

(2)

Programma Interfaccia Utente

function varargout = P94(varargin) % P94 M-file for P94.fig

% P94, by itself, creates a new P94 or raises the existing % singleton*.

%

% H = P94 returns the handle to a new P94 or the handle to % the existing singleton*.

%

% P94('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in P94.M with the given input arguments. %

% P94('Property','Value',...) creates a new P94 or raises the

% existing singleton*. Starting from the left, property value pairs are % applied to the GUI before P94_OpeningFunction gets called. An

% unrecognized property name or invalid value makes property application % stop. All inputs are passed to P94_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 P94 % Last Modified by GUIDE v2.5 03-Jan-2005 15:49:41

% Begin initialization code - DO NOT EDIT gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @P94_OpeningFcn, ... 'gui_OutputFcn', @P94_OutputFcn, ... 'gui_LayoutFcn', [] , ...

'gui_Callback', []);

if nargin & isstr(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 P94 is made visible.

function P94_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 P94 (see VARARGIN)

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

(3)

% Update handles structure guidata(hObject, handles);

set(hObject, 'Units' , 'pixels');

handles.banner = imread( 'ma-mecc.jpg' ); info = imfinfo( 'ma-mecc.jpg' );

axes( handles.axes2 ); image(handles.banner);

pos = get( handles.axes2,'Position');

set( handles.axes2, 'Visible', 'off' , 'Units' , 'pixels' , 'Position' , [ pos(1)+0.1*info.Width pos(2)+1.9*info.Height info.Width info.Height ] );

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

% --- Outputs from this function are returned to the command line.

function varargout = P94_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 nessuno1.

function nessuno1_Callback(hObject, eventdata, handles) % hObject handle to nessuno1 (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 nessuno1 set(hObject,'Value',1);

set(handles.carica1,'Value',0);

set(handles.sfoglia1,'Enable','off'); set(handles.file1,'Enable','off'); set(handles.nomefile1,'Enable','off'); set(handles.sel_v1,'Enable','off'); set(handles.pop_vel1,'Enable','off'); set(handles.button_suola1,'Enable','off'); set(handles.radio_xy1,'Enable','off');

set(handles.radio_tempoteta1,'Enable','off'); set(handles.radio_tempoX1,'Enable','off'); set(handles.radio_tempoY1,'Enable','off'); set(handles.button_risposta1,'Enable','off'); set(handles.visual1,'Enable','off');

% --- Executes on button press in carica1.

function carica1_Callback(hObject, eventdata, handles) % hObject handle to carica1 (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 carica1

(4)

set(hObject,'Value',1);

set(handles.nessuno1,'Value',0); set(handles.sfoglia1,'Enable','on'); set(handles.file1,'Enable','on'); set(handles.nomefile1,'Enable','on'); set(handles.sel_v1,'Enable','on'); set(handles.pop_vel1,'Enable','on'); set(handles.button_suola1,'Enable','on'); set(handles.radio_xy1,'Enable','on');

set(handles.radio_tempoteta1,'Enable','on'); set(handles.radio_tempoX1,'Enable','on'); set(handles.radio_tempoY1,'Enable','on'); set(handles.button_risposta1,'Enable','on'); set(handles.visual1,'Enable','on');

% --- Executes on button press in sfoglia1.

function sfoglia1_Callback(hObject, eventdata, handles) % hObject handle to sfoglia1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [filename, pathname] = uigetfile('*.m');

file_selected = 1;

set(handles.file1,'String',strcat(filename));

% --- Executes during object creation, after setting all properties.

function file1_CreateFcn(hObject, eventdata, handles) % hObject handle to file1 (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

set(hObject,'BackgroundColor','white');

else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));

end

function file1_Callback(hObject, eventdata, handles) % hObject handle to file1 (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 file1 as text

% str2double(get(hObject,'String')) returns contents of file1 as a double

% --- Executes on button press in nessuno2.

function nessuno2_Callback(hObject, eventdata, handles) % hObject handle to nessuno2 (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 nessuno2

(5)

set(hObject,'Value',1);

set(handles.carica2,'Value',0);

set(handles.sfoglia2,'Enable','off'); set(handles.file2,'Enable','off'); set(handles.nomefile2,'Enable','off'); set(handles.sel_v2,'Enable','off'); set(handles.pop_vel2,'Enable','off'); set(handles.button_suola2,'Enable','off'); set(handles.radio_xy2,'Enable','off');

set(handles.radio_tempoteta2,'Enable','off'); set(handles.radio_tempoX2,'Enable','off'); set(handles.radio_tempoY2,'Enable','off'); set(handles.button_risposta2,'Enable','off'); set(handles.visual2,'Enable','off');

% --- Executes on button press in carica2.

function carica2_Callback(hObject, eventdata, handles) % hObject handle to carica2 (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 carica2 set(hObject,'Value',1);

set(handles.nessuno2,'Value',0); set(handles.sfoglia2,'Enable','on'); set(handles.file2,'Enable','on'); set(handles.nomefile2,'Enable','on'); set(handles.sel_v2,'Enable','on'); set(handles.pop_vel2,'Enable','on'); set(handles.button_suola2,'Enable','on'); set(handles.radio_xy2,'Enable','on');

set(handles.radio_tempoteta2,'Enable','on'); set(handles.radio_tempoX2,'Enable','on'); set(handles.radio_tempoY2,'Enable','on'); set(handles.button_risposta2,'Enable','on'); set(handles.visual2,'Enable','on');

% --- Executes on button press in sfoglia2.

function sfoglia2_Callback(hObject, eventdata, handles) % hObject handle to sfoglia2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [filename, pathname] = uigetfile('*.m');

file_selected = 1;

set(handles.file2,'String',strcat(filename));

% --- Executes during object creation, after setting all properties.

function file2_CreateFcn(hObject, eventdata, handles) % hObject handle to file2 (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.

(6)

if ispc

set(hObject,'BackgroundColor','white');

else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));

end

function file2_Callback(hObject, eventdata, handles) % hObject handle to file2 (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 file2 as text

% str2double(get(hObject,'String')) returns contents of file2 as a double

% --- Executes on button press in button_suola1.

function button_suola1_Callback(hObject, eventdata, handles) % hObject handle to button_suola1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) s=get(handles.file1);

if s.String=='suola1.m'

openfig('Profilo1.fig');

else if s.String=='suola2.m'

openfig('Profilo2.fig');

else

handle = errordlg('Il profilo selezionato non è realizzabile su questa postazione!','Selezione errata!')

end end

% --- Executes on button press in button_suola2.

function button_suola2_Callback(hObject, eventdata, handles) % hObject handle to button_suola2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) s=get(handles.file2);

if s.String=='suola1.m'

openfig('Profilo1.fig');

else if s.String=='suola2.m'

openfig('Profilo2.fig');

else

(7)

handle = errordlg('Il profilo selezionato non è realizzabile su questa postazione!','Selezione errata!')

end end

% --- Executes during object creation, after setting all properties.

function pop_vel1_CreateFcn(hObject, eventdata, handles) % hObject handle to pop_vel1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc

set(hObject,'BackgroundColor','white');

else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));

end

% --- Executes on selection change in pop_vel1.

function pop_vel1_Callback(hObject, eventdata, handles) % hObject handle to pop_vel1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns pop_vel1 contents as cell array

% contents{get(hObject,'Value')} returns selected item from pop_vel1 % --- Executes during object creation, after setting all properties.

function pop_vel2_CreateFcn(hObject, eventdata, handles) % hObject handle to pop_vel2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc

set(hObject,'BackgroundColor','white');

else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));

end

% --- Executes on selection change in pop_vel2.

function pop_vel2_Callback(hObject, eventdata, handles) % hObject handle to pop_vel2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns pop_vel2 contents as cell array

% contents{get(hObject,'Value')} returns selected item from pop_vel2 % --- Executes on button press in radio_xy1.

(8)

% hObject handle to radio_xy1 (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 radio_xy1 set(hObject,'Value',1);

set(handles.radio_tempoteta1,'Value',0); set(handles.radio_tempoX1,'Value',0); set(handles.radio_tempoY1,'Value',0);

% --- Executes on button press in radio_tempoteta1.

function radio_tempoteta1_Callback(hObject, eventdata, handles) % hObject handle to radio_tempoteta1 (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 radio_tempoteta1 set(hObject,'Value',1);

set(handles.radio_xy1,'Value',0); set(handles.radio_tempoX1,'Value',0); set(handles.radio_tempoY1,'Value',0);

% --- Executes on button press in radio_tempoX1.

function radio_tempoX1_Callback(hObject, eventdata, handles) % hObject handle to radio_tempoX1 (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 radio_tempoX1 set(hObject,'Value',1);

set(handles.radio_xy1,'Value',0);

set(handles.radio_tempoteta1,'Value',0); set(handles.radio_tempoY1,'Value',0);

% --- Executes on button press in radio_tempoY1.

function radio_tempoY1_Callback(hObject, eventdata, handles) % hObject handle to radio_tempoY1 (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 radio_tempoY1 set(hObject,'Value',1);

set(handles.radio_xy1,'Value',0);

set(handles.radio_tempoteta1,'Value',0); set(handles.radio_tempoX1,'Value',0);

% --- Executes on button press in button_risposta1.

function button_risposta1_Callback(hObject, eventdata, handles) % hObject handle to button_risposta1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) u=get(handles.radio_xy1);

(9)

v=get(handles.radio_tempoteta1); w=get(handles.radio_tempoX1); z=get(handles.radio_tempoY1); s=get(handles.pop_vel1); t=get(handles.file1); if u.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p1-xy-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p1-xy-6.fig');

else if (s.Value==2 & t.String=='suola1.m')

openfig('s1-p1-xy-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p1-xy-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p1-xy-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p1-xy-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

openfig('s1-p1-xy-3.fig');

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p1-xy-3.fig'); end end end end end end end end else if v.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p1-t-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p1-t-6.fig');

else if (s.Value==2 & t.String=='suola1.m')

(10)

openfig('s1-p1-t-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p1-t-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p1-t-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p1-t-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

openfig('s1-p1-t-3.fig');

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p1-t-3.fig'); end end end end end end end end else if w.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p1-x-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p1-x-6.fig');

else if (s.Value==2 & t.String=='suola1.m')

openfig('s1-p1-x-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p1-x-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p1-x-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p1-x-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

openfig('s1-p1-x-3.fig');

(11)

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p1-x-3.fig'); end end end end end end end end else if z.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p1-y-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p1-y-6.fig');

else if (s.Value==2 & t.String=='suola1.m')

openfig('s1-p1-y-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p1-y-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p1-y-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p1-y-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

openfig('s1-p1-y-3.fig');

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p1-y-3.fig'); end end end end end end end end end end end end

(12)

% --- Executes on button press in radio_xy2.

function radio_xy2_Callback(hObject, eventdata, handles) % hObject handle to radio_xy2 (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 radio_xy2 set(hObject,'Value',1);

set(handles.radio_tempoteta2,'Value',0); set(handles.radio_tempoX2,'Value',0); set(handles.radio_tempoY2,'Value',0);

% --- Executes on button press in radio_tempoteta2.

function radio_tempoteta2_Callback(hObject, eventdata, handles) % hObject handle to radio_tempoteta2 (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 radio_tempoteta2 set(hObject,'Value',1);

set(handles.radio_xy2,'Value',0); set(handles.radio_tempoX2,'Value',0); set(handles.radio_tempoY2,'Value',0);

% --- Executes on button press in radio_tempoX2.

function radio_tempoX2_Callback(hObject, eventdata, handles) % hObject handle to radio_tempoX2 (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 radio_tempoX2 set(hObject,'Value',1);

set(handles.radio_xy2,'Value',0);

set(handles.radio_tempoteta2,'Value',0); set(handles.radio_tempoY2,'Value',0);

% --- Executes on button press in radio_tempoY2.

function radio_tempoY2_Callback(hObject, eventdata, handles) % hObject handle to radio_tempoY2 (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 radio_tempoY2 set(hObject,'Value',1);

set(handles.radio_xy2,'Value',0);

set(handles.radio_tempoteta2,'Value',0); set(handles.radio_tempoX2,'Value',0);

% --- Executes on button press in button_risposta2.

function button_risposta2_Callback(hObject, eventdata, handles) % hObject handle to button_risposta2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

(13)

u=get(handles.radio_xy2); v=get(handles.radio_tempoteta2); w=get(handles.radio_tempoX2); z=get(handles.radio_tempoY2); s=get(handles.pop_vel2); t=get(handles.file2); if u.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p2-xy-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p2-xy-6.fig');

else if (s.Value==2 & t.String=='suola1.m')

openfig('s1-p2-xy-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p2-xy-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p2-xy-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p2-xy-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

openfig('s1-p2-xy-3.fig');

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p2-xy-3.fig'); end end end end end end end end else if v.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p2-t-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p2-t-6.fig');

(14)

else if (s.Value==2 & t.String=='suola1.m')

openfig('s1-p2-t-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p2-t-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p2-t-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p2-t-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

openfig('s1-p2-t-3.fig');

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p2-t-3.fig'); end end end end end end end end else if w.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p2-x-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p2-x-6.fig');

else if (s.Value==2 & t.String=='suola1.m')

openfig('s1-p2-x-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p2-x-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p2-x-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p2-x-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

(15)

openfig('s1-p2-x-3.fig');

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p2-x-3.fig'); end end end end end end end end else if z.Value==1

if (s.Value==1 & t.String=='suola1.m')

openfig('s1-p2-y-6.fig');

else if (s.Value==1 & t.String=='suola2.m')

openfig('s2-p2-y-6.fig');

else if (s.Value==2 & t.String=='suola1.m')

openfig('s1-p2-y-5.fig');

else if (s.Value==2 & t.String=='suola2.m')

openfig('s2-p2-y-5.fig');

else if (s.Value==3 & t.String=='suola1.m')

openfig('s1-p2-y-4.fig');

else if (s.Value==3 & t.String=='suola2.m')

openfig('s2-p2-y-4.fig');

else if (s.Value==4 & t.String=='suola1.m')

openfig('s1-p2-y-3.fig');

else if (s.Value==4 & t.String=='suola2.m') openfig('s2-p2-y-3.fig'); end end end end end end end end end end end end

(16)

% --- Executes on button press in button_esci.

function button_esci_Callback(hObject, eventdata, handles) % hObject handle to button_esci (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

Uscita=questdlg('Si è sicuri di voler uscire?','Conferma Uscita','Yes');

switch Uscita case 'Yes'

close(handles.figure1); end

Riferimenti

Documenti correlati