From: tunio on
when I plot the graph, the width of the axes is different as in fig. i am using the following command to plot 2 types of data on 2 different axes.

% --- 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)

sh(1)=subplot(2,1,1);
cla;
file=get(handles.text1,'String');
data = xlsread(file);
data_len = length(data);
plot(data(1:data_len,1));


h = uicontrol('Style', 'pushbutton', 'String', 'Clear Graph/s',...
'Position', [10 10 132 30], 'Callback', 'cla');


sh(2)=subplot(2,1,2);
cla;
filea=get(handles.text2,'String');
dataascii = textread(filea);
data_lenascii = length(dataascii);
plot(dataascii);

linkaxes(sh,'x');

it,ll be very kind if some body can help me.
From: neil on
"tunio " <tunio.live(a)hotmail.com> wrote in message <i2q7qr$97j$1(a)fred.mathworks.com>...
> when I plot the graph, the width of the axes is different as in fig. i am using the following command to plot 2 types of data on 2 different axes.
>
> % --- 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)
>
> sh(1)=subplot(2,1,1);
> cla;
> file=get(handles.text1,'String');
> data = xlsread(file);
> data_len = length(data);
> plot(data(1:data_len,1));
>
>
> h = uicontrol('Style', 'pushbutton', 'String', 'Clear Graph/s',...
> 'Position', [10 10 132 30], 'Callback', 'cla');
>
>
> sh(2)=subplot(2,1,2);
> cla;
> filea=get(handles.text2,'String');
> dataascii = textread(filea);
> data_lenascii = length(dataascii);
> plot(dataascii);
>
> linkaxes(sh,'x');
>
> it,ll be very kind if some body can help me.

If you are creating the GUI in GUIDE? Then you should rather add the two axes you would like to the GUI and plot to them rather than use subplot.

You can set the Position property of the axes physically if you want.