Hello I made this gui matlab script. It calculate two graphs depending
on a value chosed in a pop up bar menu after push a pushbotton.
I dont know why i cannot set limit axes on both of the graphs. When I
run this script the program sets limits only in one graph.
plz help me!!
---------------------------------
function varargout = carnelo(varargin)
% CARNELO M-file for carnelo.fig
% CARNELO, by itself, creates a new CARNELO or raises the
existing
% singleton*.
%
% H = CARNELO returns the handle to a new CARNELO or the handle
to
% the existing singleton*.
%
% CARNELO('CALLBACK',hObject,eventData,handles,...) calls the
local
% function named CALLBACK in CARNELO.M with the given input
arguments.
%
% CARNELO('Property','Value',...) creates a new CARNELO or raises
the
% existing singleton*. Starting from the left, property value
pairs are
% applied to the GUI before carnelo_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to carnelo_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 carnelo
% Last Modified by GUIDE v2.5 20-May-2010 15:11:49
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @carnelo_OpeningFcn, ...
'gui_OutputFcn', @carnelo_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 carnelo is made visible.
function carnelo_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 carnelo (see VARARGIN)
%-----------------------------
VARIABILI----------------------------------
awrms=[7*10^-4,5*10^-4,6*10^-4,6*10^-4,6*10^-4,4*10^-4,2*10^-4,8*10^-4,3.8*10^-3,2.7*10^-3,1.4*10^-3,1.2*10^-3,6*10^-4,9*10^-4,4.3*10^-3,4.9*10^-3,4.7*10^-3,3.8*10^-3,3.4*10^-3,2.8*10^-3,0,0,0,0,0,0];
hz=[1,1.3,1.6,2.0,2.5,3.15,4.0,5.0,6.3,8.0,10,12.5,16,20.0,25.0,31.5,40,50,63,80,100,125,160,200,250,315];
accUNI=20*log10(awrms*10^6);
pond=[6,5,4,3,2,1,0,0,0,0,2,4,6,8,10,12,14,16,18,20,0,0,0,0,0,0];
db=pond+accUNI;
s=5;
g=0;
LAeq=10*log10(sum(10.^(db.*0.1)));
x=[5,5,20,20,25,25,35,35,45,45];
v=[135,200,300,400]
handles.db=db;
%-------------------CALCOLO ATTENUAZIONE
TERRENO-------------------------
for j=1:4
for k=1:1:10;
for z=1:1:26;
att1(k,z,j)=(x(k)*8.68*3.14*hz(z)*0.1)/v(j);
end;
end;
end;
for j=1:10
b(j)=g*log10(x(j)/s)
end
for j=1:4
for p=1:10
att2(p,:,j)=+b(p)+att1(p,:,j);
end;
end;
for j=1:4
for z=1:1:10;
fine(z,1:26,j)=db(1,1:26)-att2(z,1:26,j)
end;
end;
anto=(10.^(fine.*0.1));
for z=1:10;
LAeq(z)=10*log10(sum(anto(z,1:26)));
end
%----------------------------CALCOLO ATTENUAZIONE
TERRENO----------------
%plot(hz,fine(5,1:26))
muraa=xlsread ('pala.xls','sorgente&coefficienti','c58:ab58');
murab=xlsread ('pala.xls','sorgente&coefficienti','c59:ab59');
murac=xlsread ('pala.xls','sorgente&coefficienti','c61:ab61');
%------EFFETTO ACCOPPIAMENTO TERRENO
EDIFICIO----------------------------
for j=1:4;
for z=1:1:10;
terred(z,1:26,j)=fine(z,1:26,j)-murac(1,1:26);
end;
end
anto2=(10.^(terred.*0.1));
for z=1:10;
LAeq2(z)=10*log10(sum(anto2(z,1:26)));
end;
handles.fine=fine;
handles.hz=hz;
% Choose default command line output for carnelo
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes carnelo wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = carnelo_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 selection change in popumenu1.
function popumenu1_Callback(hObject, eventdata, handles)
% hObject handle to popumenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
switch get(hObject, 'Value');
case 1
handles.corrente=handles.fine(5,1:26,1);
case 2
handles.corrente=handles.fine(5,1:26,2);
case 3
handles.corrente=handles.fine(5,1:26,3);
case 4
handles.corrente=handles.fine(5,1:26,4);
end
guidata(hObject,handles)
% Hints: contents = cellstr(get(hObject,'String')) returns popumenu1
contents as cell array
% contents{get(hObject,'Value')} returns selected item from
popumenu1
% --- Executes during object creation, after setting all properties.
function popumenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popumenu1 (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 && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
bar(handles.axes1,handles.hz,handles.corrente)
set(handles.axes1,'XMinorTick','on')
grid on
bar(handles.axes2,handles.hz,handles.db)
set(handles.axes2,'XMinorTick','on')
grid on
----------------------------
|