Error using subplot, undefined function or variable

I'm using in a wrong way subplots. I want to plot two matrices in the same figure using two subplots.
figure
subplot(2,1,1);
plot(valmedio,'DisplayName','valmedio')
set(gca,'XTick', [0,50,100,150,200,250,300]);
set(gca,'XTickLabel',[0,1000,2000,3000,4000,5000,6000]);
legend('Location','northwest')
grid minor
title('Plot valmedio 0 ÷ 6 Km.')
sublpot(2,1,2);
plot(valmedio(1:30,:),'DisplayName','valmedio')
set(gca,'XTick', [0,5,10,15,20,25]);
set(gca,'XTickLabel',[0,100,200,300,400,500,600]);
legend('Location','northwest')
grid minor
title('Plot valmedio 0 ÷ 600 m.')

3 Comments

@Ana: If you open a FIG file in R2017a and save the GUI afterwards, it might not open in earlier versions anymore. The dialogs created by GUIDE are not compatible with other Matlab versions.
Also, ishg2parent seems to be undocumented (about the only hits on Google are from Yair Altman, there is no reference to this function in the release notes, and my R2017b doesn't recognize that function either).
It might also be an internal function somewhere buried deep, as it looks like it is a subfunction of legend in R2014b, but in my copy it is no longer there.

Sign in to comment.

Answers (1)

Hi Dario,
The reason for the error is the function ‘subplot()’ being spelled incorrectly as SUBLPOT in line 10. On correcting this function call, I am getting two subplots in the output figure.
Hope this helps.
Thanks

Asked:

on 14 Mar 2018

Answered:

on 27 Mar 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!