MATLAB Answers

Trouble using suplabel() to create global axes for figure with multiple subplots

4 views (last 30 days)
Kateri Kaminski
Kateri Kaminski on 5 Nov 2018
Answered: Sindar on 14 Jul 2019
Hello, I am having some trouble using suplabel(). I want 2 global axes labels (one x and one y) for my figure that contains multiple subplots. I was able to do this with the title using suptitle() so I am assuming I have a version of Matlab that can handle suplabel() as well but I am not getting it to work. Does anyone know why this might not be working? I get the following error message:
>> PostProcessing_filetest
Undefined function or variable 'suplabel'.
Error in PostProcessing_filetest (line 266)
suplabel('Frequecy(Hz)','x')
I have attached a portion of my code if that helps. Thanks!
%Create Plots
for j = index
figure(fignum)
fignum = fignum + 1;
hold on
for i = 1:numfiles
subplot(numfiles,1,i)
y = Farray(2:end);
yt = transpose(y);
x(:,:,i,j) = NewAmp(:,:,i,j);
xt(:,:,i,j) = transpose(x(:,:,i,j));
plot(y,xt(:,:,i,j))
title(fn(i))
axis([0 Fmax 0 1.5*maxNewAmp(:,:,i,j)])
end
t1 = strcat("Reference Probe: ",fn(j));
t2 = strcat(namexparm, " = ", string(xparmmax(:,:,j)),"(", unitsxparm, ")");
suptitle({char(t1);char(t2)})
suplabel('Frequecy(Hz)','x')
suplabel('Amplitude', 'y')
hold off
end

Answers (1)

Sindar
Sindar on 14 Jul 2019
sublabel does not exist in Matlab releases. You can download the user-created sublabel from the File Exchange and put it on your matlab path

Community Treasure Hunt

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

Start Hunting!